on xenial help sign in
disable dragging of items with an angle > 20 degrees
2ec9e84Michael Zanetti
Launcher/LauncherPanel.qml+18−26
@@ -296,6 +296,10 @@ Item {
296 }
296 }
297
297
298 onPressAndHold: {
298 onPressAndHold: {
299+ if (Math.abs(selectedItem.angle) > 30) {
300+ return;
301+ }
302+
299 draggedIndex = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
303 draggedIndex = Math.floor((mouseY + launcherListView.realContentY) / launcherListView.realItemHeight);
300
304
301 launcherListView.interactive = false
305 launcherListView.interactive = false
@@ -305,6 +309,9 @@ Item {
305 fakeDragItem.iconName = launcherListView.model.get(draggedIndex).icon
309 fakeDragItem.iconName = launcherListView.model.get(draggedIndex).icon
306 fakeDragItem.x = 0
310 fakeDragItem.x = 0
307 fakeDragItem.y = mouseY - yOffset + launcherListView.anchors.topMargin + launcherListView.topMargin
311 fakeDragItem.y = mouseY - yOffset + launcherListView.anchors.topMargin + launcherListView.topMargin
312+ fakeDragItem.angle = selectedItem.angle * (root.inverted ? -1 : 1)
313+ fakeDragItem.offset = selectedItem.offset * (root.inverted ? -1 : 1)
314+ fakeDragItem.flatten()
308 drag.target = fakeDragItem
315 drag.target = fakeDragItem
309
316
310 startX = mouseX
317 startX = mouseX
@@ -379,32 +386,6 @@ Item {
379 }
386 }
380 }
387 }
381 }
388 }
382−
383− MouseArea {
384− id: topFoldingArea
385− anchors {
386− left: parent.left
387− right: parent.right
388− top: parent.top
389− topMargin: launcherListView.topMargin
390− }
391− height: launcherListView.itemSize / 2
392− enabled: launcherListView.contentY > -launcherListView.topMargin
393− onClicked: launcherListView.flick(0, launcherListView.clickFlickSpeed)
394− }
395−
396− MouseArea {
397− id: bottomFoldingArea
398− anchors {
399− left: parent.left
400− right: parent.right
401− bottom: parent.bottom
402− bottomMargin: launcherListView.bottomMargin
403− }
404− height: launcherListView.itemHeight / 2
405− enabled: launcherListView.contentHeight - launcherListView.height - launcherListView.contentY > -launcherListView.bottomMargin
406− onClicked: launcherListView.flick(0, -launcherListView.clickFlickSpeed)
407− }
408 }
389 }
409 }
390 }
410
391
@@ -419,6 +400,17 @@ Item {
419 rotation: root.rotation
400 rotation: root.rotation
420 highlighted: true
401 highlighted: true
421 itemOpacity: 0.8
402 itemOpacity: 0.8
403+
404+ function flatten() {
405+ fakeDragItemAnimation.start();
406+ }
407+
408+ UbuntuNumberAnimation {
409+ id: fakeDragItemAnimation
410+ target: fakeDragItem;
411+ properties: "angle,offset";
412+ to: 0
413+ }
422 }
414 }
423 }
415 }
424 }
416 }