on xenial help sign in
reenable folding while dnd
c9a45aeMichael Zanetti
Launcher/LauncherListDelegate.qml+6−1
@@ -22,6 +22,10 @@ LauncherDelegate {
22
22
23 // The angle used for rotating
23 // The angle used for rotating
24 angle: {
24 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+
25 // First/last items are special
29 // First/last items are special
26 if (index == 0 || index == priv.listView.count-1) {
30 if (index == 0 || index == priv.listView.count-1) {
27 if (priv.distanceFromEdge < 0) {
31 if (priv.distanceFromEdge < 0) {
@@ -120,8 +124,9 @@ LauncherDelegate {
120 property real totalEffectiveHeight: effectiveHeight + listView.spacing
124 property real totalEffectiveHeight: effectiveHeight + listView.spacing
121 property real effectiveContentY: listView.contentY - listView.originY
125 property real effectiveContentY: listView.contentY - listView.originY
122 property real effectiveY: y - listView.originY
126 property real effectiveY: y - listView.originY
127+ property real bottomDraggingDistanceOffset: listView.draggedIndex > index ? totalUnfoldedHeight : 0
123 property real distanceFromTopEdge: -(effectiveContentY + listView.topMargin - index*totalUnfoldedHeight)
128 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
125
130
126 property real distanceFromEdge: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? distanceFromBottomEdge : distanceFromTopEdge
131 property real distanceFromEdge: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? distanceFromBottomEdge : distanceFromTopEdge
127 property real orientationFlag: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? -1 : 1
132 property real orientationFlag: Math.abs(distanceFromBottomEdge) < Math.abs(distanceFromTopEdge) ? -1 : 1
Launcher/LauncherPanel.qml+17−7
@@ -81,6 +81,7 @@ Item {
81 anchors.left: parent.left
81 anchors.left: parent.left
82 anchors.right: parent.right
82 anchors.right: parent.right
83 height: parent.height - dashItem.height - parent.spacing*2
83 height: parent.height - dashItem.height - parent.spacing*2
84+
84 ListView {
85 ListView {
85 id: launcherListView
86 id: launcherListView
86 objectName: "launcherListView"
87 objectName: "launcherListView"
@@ -102,6 +103,7 @@ Item {
102 property int foldingAreaHeight: itemSize * 0.75
103 property int foldingAreaHeight: itemSize * 0.75
103 property int itemSize: width
104 property int itemSize: width
104 property int clickFlickSpeed: units.gu(60)
105 property int clickFlickSpeed: units.gu(60)
106+ property int draggedIndex: dndArea.draggedIndex
105
107
106 displaced: Transition {
108 displaced: Transition {
107 NumberAnimation { properties: "x,y"; duration: 100 }
109 NumberAnimation { properties: "x,y"; duration: 100 }
@@ -134,7 +136,7 @@ Item {
134 },
136 },
135 State {
137 State {
136 name: "expanded"
138 name: "expanded"
137− when: dndArea.draggedIndex >= 0 && !dragging
139+ //when: dndArea.draggedIndex >= 0 && !dragging
138 PropertyChanges {
140 PropertyChanges {
139 target: launcherDelegate
141 target: launcherDelegate
140 angle: 0
142 angle: 0
@@ -147,7 +149,7 @@ Item {
147 Transition {
149 Transition {
148 from: "*"
150 from: "*"
149 to: "*"
151 to: "*"
150− NumberAnimation { properties: "angle,offset"; duration: 200 }
152+// NumberAnimation { properties: "angle,offset"; duration: 200 }
151 NumberAnimation { properties: "height"; duration: 150 }
153 NumberAnimation { properties: "height"; duration: 150 }
152 }
154 }
153 ]
155 ]
@@ -222,11 +224,19 @@ Item {
222 selectedItem.dragging = false;
224 selectedItem.dragging = false;
223 selectedItem = undefined;
225 selectedItem = undefined;
224
226
227+ var droppedIndex = draggedIndex;
225 draggedIndex = -1;
228 draggedIndex = -1;
226 drag.target = undefined
229 drag.target = undefined
227− launcherListView.interactive = true;
228
230
229 progressiveScrollingTimer.stop();
231 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;
230 }
240 }
231
241
232 onPressAndHold: {
242 onPressAndHold: {
@@ -279,18 +289,18 @@ Item {
279 // Move it down by the the missing size to compensate index calculation with only expanded items
289 // Move it down by the the missing size to compensate index calculation with only expanded items
280 itemCenterY += selectedItem.height / 2
290 itemCenterY += selectedItem.height / 2
281
291
282− print("mouseY", mouseY, launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemSize)
292+// print("mouseY", mouseY, launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemSize)
283 if (mouseY > launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemSize) {
293 if (mouseY > launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemSize) {
284− print("entered bottom area")
294+// print("entered bottom area")
285 progressiveScrollingTimer.downwards = false
295 progressiveScrollingTimer.downwards = false
286 progressiveScrollingTimer.start()
296 progressiveScrollingTimer.start()
287 } else if (mouseY < realItemSize) {
297 } else if (mouseY < realItemSize) {
288 progressiveScrollingTimer.downwards = true
298 progressiveScrollingTimer.downwards = true
289 progressiveScrollingTimer.start()
299 progressiveScrollingTimer.start()
290− print("entered top area")
300+// print("entered top area")
291 } else {
301 } else {
292 progressiveScrollingTimer.stop()
302 progressiveScrollingTimer.stop()
293− print("not in any area")
303+// print("not in any area")
294 }
304 }
295
305
296 var newIndex = (itemCenterY + realContentY) / realItemSize
306 var newIndex = (itemCenterY + realContentY) / realItemSize