@@ -89,11 +89,11 @@ Item {
89 objectName: "launcherListView"
89 objectName: "launcherListView"
91 fill: parent
91 fill: parent
92− topMargin: -itemHeight + units.gu(0.5)
92+ topMargin: -extensionSize + units.gu(0.5)
93− bottomMargin: -itemHeight + units.gu(1)
93+ bottomMargin: -extensionSize + units.gu(1)
95− topMargin: itemHeight
95+ topMargin: extensionSize
96− bottomMargin: itemHeight
96+ bottomMargin: extensionSize
97 height: parent.height - dashItem.height - parent.spacing*2
97 height: parent.height - dashItem.height - parent.spacing*2
98 model: root.model
98 model: root.model
99 cacheBuffer: itemHeight * 3
99 cacheBuffer: itemHeight * 3
@@ -104,6 +104,11 @@ Item {
104 layoutDirection: root.inverted ? Qt.RightToLeft : Qt.LeftToRight
104 layoutDirection: root.inverted ? Qt.RightToLeft : Qt.LeftToRight
105 spacing: units.gu(0.5)
105 spacing: units.gu(0.5)
107+ // The size of the area the ListView is extended to make sure items are not
108+ // destructed. Note that if the move() operation when dragging switches
109+ // the item with one that doesn't have a delegate yet everything breaks badly.
110+ property int extensionSize: itemHeight * 3
107 // The height of the area where icons start getting folded
112 // The height of the area where icons start getting folded
108 property int foldingAreaHeight: itemHeight * 0.75
113 property int foldingAreaHeight: itemHeight * 0.75
109 property int itemWidth: width
114 property int itemWidth: width
@@ -115,8 +120,6 @@ Item {
115 NumberAnimation { properties: "x,y"; duration: 100 }
120 NumberAnimation { properties: "x,y"; duration: 100 }
118− onContentYChanged: print("contentY", contentY)
120 delegate: LauncherListDelegate {
123 delegate: LauncherListDelegate {
121 id: launcherDelegate
124 id: launcherDelegate
122 objectName: "launcherDelegate" + index
125 objectName: "launcherDelegate" + index
@@ -177,8 +180,19 @@ Item {
177 Transition {
180 Transition {
178 from: "dragging"
181 from: "dragging"
180− NumberAnimation { properties: "itemOpacity"; duration: 150 }
183+ NumberAnimation { properties: "itemOpacity"; duration: 1500 }
188+ NumberAnimation { properties: "angle"; duration: 150 }
193+ NumberAnimation { properties: "angle"; duration: 150 }
@@ -206,8 +220,6 @@ Item {
206 var index = Math.floor((mouseY + realContentY) / realItemHeight);
220 var index = Math.floor((mouseY + realContentY) / realItemHeight);
207 var clickedItem = launcherListView.itemAt(mouseX, mouseY + realContentY)
221 var clickedItem = launcherListView.itemAt(mouseX, mouseY + realContentY)
209− print("clicked on", index, clickedItem)
211 // First/last item do the scrolling at more than 12 degrees
223 // First/last item do the scrolling at more than 12 degrees
212 if (index == 0 || index == launcherListView.count -1) {
224 if (index == 0 || index == launcherListView.count -1) {
213 if (clickedItem.angle > 12) {
225 if (clickedItem.angle > 12) {
@@ -232,27 +244,20 @@ Item {
233 onCanceled: {
245 onCanceled: {
234 selectedItem.highlighted = false
246 selectedItem.highlighted = false
247+ selectedItem = undefined;
237 onReleased: {
250 onReleased: {
239 selectedItem.highlighted = false
251 selectedItem.highlighted = false
240 selectedItem.dragging = false;
252 selectedItem.dragging = false;
241 selectedItem = undefined;
253 selectedItem = undefined;
243− var droppedIndex = draggedIndex;
244 draggedIndex = -1;
255 draggedIndex = -1;
245 drag.target = undefined
256 drag.target = undefined
247 progressiveScrollingTimer.stop();
258 progressiveScrollingTimer.stop();
249− // FIXME: remove the if condition once the ListView position bug is fixed.
250− // Right now setting currentIndex to 0 causes more issues than it helps.
251−// if (droppedIndex > 2) {
252−// launcherListView.currentIndex = -1;
253−// launcherListView.currentIndex = droppedIndex;
255 launcherListView.interactive = true;
259 launcherListView.interactive = true;
258 onPressAndHold: {
263 onPressAndHold: {
@@ -271,7 +276,7 @@ Item {
272 fakeDragItem.iconName = launcherListView.model.get(draggedIndex).icon
277 fakeDragItem.iconName = launcherListView.model.get(draggedIndex).icon
273 fakeDragItem.x = 0
278 fakeDragItem.x = 0
274− fakeDragItem.y = mouseY - yOffset
279+ fakeDragItem.y = mouseY - yOffset + launcherListView.anchors.topMargin + launcherListView.topMargin
275 drag.target = fakeDragItem
280 drag.target = fakeDragItem
277 startX = mouseX
282 startX = mouseX
@@ -284,7 +289,6 @@ Item {
284 if (!selectedItem.dragging) {
289 if (!selectedItem.dragging) {
285 var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY))
290 var distance = Math.max(Math.abs(mouseX - startX), Math.abs(mouseY - startY))
286 if (distance > launcherListView.itemHeight) {
291 if (distance > launcherListView.itemHeight) {
287− print("starting drag")
288 selectedItem.dragging = true
292 selectedItem.dragging = true
289 PopupUtils.close(quickListPopover)
293 PopupUtils.close(quickListPopover)
@@ -293,9 +297,6 @@ Item {
296− //launcherPanel.dragPosition = inverted ? launcherListView.height - y : y
297− //root.dragPosition = mouseY
299 var realContentY = launcherListView.contentY + launcherListView.topMargin
300 var realContentY = launcherListView.contentY + launcherListView.topMargin
300 var realItemHeight = launcherListView.itemHeight + launcherListView.spacing
301 var realItemHeight = launcherListView.itemHeight + launcherListView.spacing
301 var itemCenterY = fakeDragItem.y + fakeDragItem.height / 2
302 var itemCenterY = fakeDragItem.y + fakeDragItem.height / 2
@@ -303,18 +304,14 @@ Item {
303 // Move it down by the the missing size to compensate index calculation with only expanded items
304 // Move it down by the the missing size to compensate index calculation with only expanded items
304 itemCenterY += selectedItem.height / 2
305 itemCenterY += selectedItem.height / 2
306−// print("mouseY", mouseY, launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemHeight)
307 if (mouseY > launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemHeight) {
307 if (mouseY > launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemHeight) {
308−// print("entered bottom area")
309 progressiveScrollingTimer.downwards = false
308 progressiveScrollingTimer.downwards = false
310 progressiveScrollingTimer.start()
309 progressiveScrollingTimer.start()
311 } else if (mouseY < realItemHeight) {
310 } else if (mouseY < realItemHeight) {
312 progressiveScrollingTimer.downwards = true
311 progressiveScrollingTimer.downwards = true
313 progressiveScrollingTimer.start()
312 progressiveScrollingTimer.start()
314−// print("entered top area")
316 progressiveScrollingTimer.stop()
314 progressiveScrollingTimer.stop()
317−// print("not in any area")
320 var newIndex = (itemCenterY + realContentY) / realItemHeight
317 var newIndex = (itemCenterY + realContentY) / realItemHeight
@@ -328,7 +325,6 @@ Item {
330 if (newIndex >= 0 && newIndex < launcherListView.count) {
327 if (newIndex >= 0 && newIndex < launcherListView.count) {
331− print("moving", draggedIndex, "to", newIndex)
332 launcherListView.model.move(draggedIndex, newIndex)
328 launcherListView.model.move(draggedIndex, newIndex)
333 draggedIndex = newIndex
329 draggedIndex = newIndex
@@ -350,7 +346,6 @@ Item {
351 var maxY = launcherListView.contentHeight - launcherListView.height + launcherListView.topMargin + dndArea.selectedItem.effectiveHeight*2
347 var maxY = launcherListView.contentHeight - launcherListView.height + launcherListView.topMargin + dndArea.selectedItem.effectiveHeight*2
352 if (launcherListView.contentY < maxY) {
348 if (launcherListView.contentY < maxY) {
353− print("moving upwards", launcherListView.contentHeight, launcherListView.height, launcherListView.topMargin, dndArea.selectedItem.height, dndArea.selectedItem.effectiveHeight)
354 launcherListView.contentY = Math.min(launcherListView.contentY + units.dp(2), maxY)
349 launcherListView.contentY = Math.min(launcherListView.contentY + units.dp(2), maxY)