on xenial help sign in
reenable folding while dnd
commitc9a45ae68d121b9c3705cfbc56da2718799f705d authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 14 Aug 2013, 16:56 (13 years ago) parent0329f78
2 files changed+23−8
Launcher/LauncherListDelegate.qml+6−1 Launcher/LauncherPanel.qml+17−7
Launcher/LauncherListDelegate.qml+6−1
@@ -22,6 +22,10 @@ LauncherDelegate {
2222
2323 // The angle used for rotating
2424 angle: {
25+ if (index == 1 || index == priv.listView.count - 2) {
26+ print("index", index, iconName, "overlaps with folding area", priv.overlapWithFoldingArea, priv.distanceFromEdge, priv.bottomDraggingDistanceOffset)
27+ }
28+
2529 // First/last items are special
2630 if (index == 0 || index == priv.listView.count-1) {
2731 if (priv.distanceFromEdge < 0) {
@@ -120,8 +124,9 @@ LauncherDelegate {
120124 property real totalEffectiveHeight: effectiveHeight + listView.spacing
121125 property real effectiveContentY: listView.contentY - listView.originY
122126 property real effectiveY: y - listView.originY
127+ property real bottomDraggingDistanceOffset: listView.draggedIndex > index ? totalUnfoldedHeight : 0
123128 property real distanceFromTopEdge: -(effectiveContentY + listView.topMargin - index*totalUnfoldedHeight)
124− property real distanceFromBottomEdge: listView.height - listView.bottomMargin - (effectiveY+height) + effectiveContentY
129+ property real distanceFromBottomEdge: listView.height - listView.bottomMargin - (effectiveY+height) + effectiveContentY + bottomDraggingDistanceOffset
125130
126131 property real distanceFromEdge: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? distanceFromBottomEdge : distanceFromTopEdge
127132 property real orientationFlag: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? -1 : 1
Launcher/LauncherPanel.qml+17−7
@@ -81,6 +81,7 @@ Item {
8181 anchors.left: parent.left
8282 anchors.right: parent.right
8383 height: parent.height - dashItem.height - parent.spacing*2
84+
8485 ListView {
8586 id: launcherListView
8687 objectName: "launcherListView"
@@ -102,6 +103,7 @@ Item {
102103 property int foldingAreaHeight: itemSize * 0.75
103104 property int itemSize: width
104105 property int clickFlickSpeed: units.gu(60)
106+ property int draggedIndex: dndArea.draggedIndex
105107
106108 displaced: Transition {
107109 NumberAnimation { properties: "x,y"; duration: 100 }
@@ -134,7 +136,7 @@ Item {
134136 },
135137 State {
136138 name: "expanded"
137− when: dndArea.draggedIndex >= 0 && !dragging
139+ //when: dndArea.draggedIndex >= 0 && !dragging
138140 PropertyChanges {
139141 target: launcherDelegate
140142 angle: 0
@@ -147,7 +149,7 @@ Item {
147149 Transition {
148150 from: "*"
149151 to: "*"
150− NumberAnimation { properties: "angle,offset"; duration: 200 }
152+// NumberAnimation { properties: "angle,offset"; duration: 200 }
151153 NumberAnimation { properties: "height"; duration: 150 }
152154 }
153155 ]
@@ -222,11 +224,19 @@ Item {
222224 selectedItem.dragging = false;
223225 selectedItem = undefined;
224226
227+ var droppedIndex = draggedIndex;
225228 draggedIndex = -1;
226229 drag.target = undefined
227− launcherListView.interactive = true;
228230
229231 progressiveScrollingTimer.stop();
232+
233+ // FIXME: remove the if condition once the ListView position bug is fixed.
234+ // Right now setting currentIndex to 0 causes more issues than it helps.
235+ if (droppedIndex > 2) {
236+ launcherListView.currentIndex = -1;
237+ launcherListView.currentIndex = droppedIndex;
238+ }
239+ launcherListView.interactive = true;
230240 }
231241
232242 onPressAndHold: {
@@ -279,18 +289,18 @@ Item {
279289 // Move it down by the the missing size to compensate index calculation with only expanded items
280290 itemCenterY += selectedItem.height / 2
281291
282− print("mouseY", mouseY, launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemSize)
292+// print("mouseY", mouseY, launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemSize)
283293 if (mouseY > launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemSize) {
284− print("entered bottom area")
294+// print("entered bottom area")
285295 progressiveScrollingTimer.downwards = false
286296 progressiveScrollingTimer.start()
287297 } else if (mouseY < realItemSize) {
288298 progressiveScrollingTimer.downwards = true
289299 progressiveScrollingTimer.start()
290− print("entered top area")
300+// print("entered top area")
291301 } else {
292302 progressiveScrollingTimer.stop()
293− print("not in any area")
303+// print("not in any area")
294304 }
295305
296306 var newIndex = (itemCenterY + realContentY) / realItemSize