@@ -113,6 +113,8 @@ Item {
113 property int itemHeight: width * 7.5 / 8
113 property int itemHeight: width * 7.5 / 8
114 property int clickFlickSpeed: units.gu(60)
114 property int clickFlickSpeed: units.gu(60)
115 property int draggedIndex: dndArea.draggedIndex
115 property int draggedIndex: dndArea.draggedIndex
116+ property real realContentY: contentY - originY + topMargin
117+ property int realItemHeight: itemHeight + spacing
117 displaced: Transition {
119 displaced: Transition {
118 NumberAnimation { properties: "x,y"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
120 NumberAnimation { properties: "x,y"; duration: UbuntuAnimation.FastDuration; easing: UbuntuAnimation.StandardEasing }
@@ -231,16 +233,13 @@ Item {
231 property int startY
233 property int startY
233 onPressed: {
235 onPressed: {
234− var realContentY = launcherListView.contentY + launcherListView.topMargin
235− selectedItem = launcherListView.itemAt(mouseX, mouseY + realContentY)
236+ selectedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
236 selectedItem.highlighted = true
237 selectedItem.highlighted = true
239 onClicked: {
240 onClicked: {
240− var realItemHeight = launcherListView.itemHeight + launcherListView.spacing
241− var realContentY = launcherListView.contentY + launcherListView.topMargin
242− var index = Math.floor((mouseY + realContentY) / realItemHeight);
241+ var index = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
243− var clickedItem = launcherListView.itemAt(mouseX, mouseY + realContentY)
242+ var clickedItem = launcherListView.itemAt(mouseX, mouseY + launcherListView.realContentY)
245 // First/last item do the scrolling at more than 12 degrees
244 // First/last item do the scrolling at more than 12 degrees
246 if (index == 0 || index == launcherListView.count -1) {
245 if (index == 0 || index == launcherListView.count -1) {
@@ -286,13 +285,11 @@ Item {
288 onPressAndHold: {
287 onPressAndHold: {
289− var realItemHeight = launcherListView.itemHeight + launcherListView.spacing
290− var realContentY = launcherListView.contentY + launcherListView.topMargin
291− draggedIndex = Math.floor((mouseY + realContentY) / realItemHeight);
288+ draggedIndex = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
293 launcherListView.interactive = false
290 launcherListView.interactive = false
295− var yOffset = draggedIndex > 0 ? (mouseY + realContentY) % (draggedIndex * realItemHeight) : mouseY + realContentY
292+ var yOffset = draggedIndex > 0 ? (mouseY + launcherListView.realContentY) % (draggedIndex * launcherListView.realItemHeight) : mouseY + launcherListView.realContentY
297 fakeDragItem.iconName = launcherListView.model.get(draggedIndex).icon
294 fakeDragItem.iconName = launcherListView.model.get(draggedIndex).icon
298 fakeDragItem.x = 0
295 fakeDragItem.x = 0
@@ -319,24 +316,22 @@ Item {
322− var realContentY = launcherListView.contentY + launcherListView.topMargin
323− var realItemHeight = launcherListView.itemHeight + launcherListView.spacing
324 var itemCenterY = fakeDragItem.y + fakeDragItem.height / 2
319 var itemCenterY = fakeDragItem.y + fakeDragItem.height / 2
326 // Move it down by the the missing size to compensate index calculation with only expanded items
321 // Move it down by the the missing size to compensate index calculation with only expanded items
327 itemCenterY += (launcherListView.itemHeight - selectedItem.height) / 2
322 itemCenterY += (launcherListView.itemHeight - selectedItem.height) / 2
329− if (mouseY > launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - realItemHeight) {
324+ if (mouseY > launcherListView.height - launcherListView.topMargin - launcherListView.bottomMargin - launcherListView.realItemHeight) {
330 progressiveScrollingTimer.downwards = false
325 progressiveScrollingTimer.downwards = false
331 progressiveScrollingTimer.start()
326 progressiveScrollingTimer.start()
332− } else if (mouseY < realItemHeight) {
327+ } else if (mouseY < launcherListView.realItemHeight) {
333 progressiveScrollingTimer.downwards = true
328 progressiveScrollingTimer.downwards = true
334 progressiveScrollingTimer.start()
329 progressiveScrollingTimer.start()
336 progressiveScrollingTimer.stop()
331 progressiveScrollingTimer.stop()
339− var newIndex = (itemCenterY + realContentY) / realItemHeight
334+ var newIndex = (itemCenterY + launcherListView.realContentY) / launcherListView.realItemHeight
341 if (newIndex > draggedIndex + 1) {
336 if (newIndex > draggedIndex + 1) {
342 newIndex = draggedIndex + 1
337 newIndex = draggedIndex + 1