From 95bca4b50c4fd46ae190ac87ea8934523881b776 Mon Sep 17 00:00:00 2001 From: Sebastian Kügler Date: Thu, 7 Jan 2016 00:39:33 +0100 Subject: sync with mobilecomponents 9d179eb74a227 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Workaround for black squares is merged upstream - brings back the FAB button, additional - swipe interaction improvements in the same Signed-off-by: Sebastian Kügler --- .../qml/mobilecomponents/private/ActionButton.qml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'qt-mobile/qml/mobilecomponents/private') diff --git a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml index 80f037e48..c6963c285 100644 --- a/qt-mobile/qml/mobilecomponents/private/ActionButton.qml +++ b/qt-mobile/qml/mobilecomponents/private/ActionButton.qml @@ -29,9 +29,9 @@ MouseArea { property bool checked: false //either Action or QAction should work here property QtObject action - Layout.minimumWidth: Units.iconSizes.large + Layout.minimumWidth: Units.iconSizes.medium Layout.maximumWidth: Layout.minimumWidth - implicitWidth: Units.iconSizes.large + implicitWidth: Units.iconSizes.medium implicitHeight: width drag { target: button @@ -52,11 +52,21 @@ MouseArea { transform: Translate { id: translateTransform } + property var downTimestamp; + property int startX + onPressed: { + downTimestamp = (new Date()).getTime(); + startX = button.x + } onReleased: { - if (globalDrawer && x > Math.min(parent.width/4*3, parent.width/2 + globalDrawer.contentItem.width/2)) { + //pixel/second + var speed = ((button.x - startX) / ((new Date()).getTime() - downTimestamp) * 1000); + + //project where it would be a full second in the future + if (globalDrawer && x + speed > Math.min(parent.width/4*3, parent.width/2 + globalDrawer.contentItem.width/2)) { globalDrawer.open(); contextDrawer.close(); - } else if (contextDrawer && x < Math.max(parent.width/4, parent.width/2 - contextDrawer.contentItem.width/2)) { + } else if (contextDrawer && x + speed < Math.max(parent.width/4, parent.width/2 - contextDrawer.contentItem.width/2)) { if (contextDrawer) { contextDrawer.open(); } -- cgit v1.2.3-70-g09d2