on xenial help sign in
improve snapping after dragging

This fixes an issue that the listView was doing some weird bounce effect when dropping items at the top or bottom because of some flicking that tried to make sure the dropped item is completely visible. This didn't work reliably and introduced the above issue. The new code uses some animation to move around contentY which seems to be much more reliable and avoids the issue. Fixes: #1336665 Approved by: Andrea Cimitan, PS Jenkins bot

commitdb59cf059d448c3d52a4425fe9a2193f48a92f8d authorMichael Zanetti <michael.zanetti@canonical.com> dateTue 25 Nov 2014, 13:53 (12 years ago) parent688a67a103394a
1 file changed+17−5
qml/Launcher/LauncherPanel.qml+17−5
qml/Launcher/LauncherPanel.qml+17−5
@@ -55,7 +55,6 @@ Rectangle {
5555 width: parent.width
5656 height: units.gu(7)
5757 color: UbuntuColors.orange
58− z: 1
5958
6059 Image {
6160 objectName: "dashItem"
@@ -137,6 +136,20 @@ Rectangle {
137136 property bool draggingTransitionRunning: false
138137 property int scheduledMoveTo: -1
139138
139+ UbuntuNumberAnimation {
140+ id: snapToBottomAnimation
141+ target: launcherListView
142+ property: "contentY"
143+ to: launcherListView.originY
144+ }
145+
146+ UbuntuNumberAnimation {
147+ id: snapToTopAnimation
148+ target: launcherListView
149+ property: "contentY"
150+ to: launcherListView.contentHeight - launcherListView.height + launcherListView.originY
151+ }
152+
140153 displaced: Transition {
141154 NumberAnimation { properties: "x,y"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
142155 }
@@ -342,10 +355,9 @@ Rectangle {
342355 progressiveScrollingTimer.stop();
343356 launcherListView.interactive = true;
344357 if (droppedIndex >= launcherListView.count - 2 && postDragging) {
345− launcherListView.flick(0, -launcherListView.clickFlickSpeed);
346− }
347− if (droppedIndex == 0 && postDragging) {
348− launcherListView.flick(0, launcherListView.clickFlickSpeed);
358+ snapToBottomAnimation.start();
359+ } else if (droppedIndex < 2 && postDragging) {
360+ snapToTopAnimation.start();
349361 }
350362 }
351363