on xenial help sign in
don't reach out of context
commit013e5b147fbae35faad8c1cebda5e055061290f8 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 23 Mar 2017, 11:31 (10 years ago) parentae545ea
2 files changed+16−11
qml/Stage/Spread/SpreadDelegateInputArea.qml+14−11 qml/Stage/Stage.qml+2
qml/Stage/Spread/SpreadDelegateInputArea.qml+14−11
@@ -28,6 +28,9 @@ Item {
2828
2929 readonly property alias distance: d.distance
3030
31+ property var stage: null
32+ property var dragDelegate: null
33+
3134 signal clicked()
3235 signal close()
3336
@@ -116,13 +119,13 @@ Item {
116119
117120 var value = tp.y - tp.startY - offset;
118121 if (value < 0) {
119− var coords = mapToItem(shell, tp.x, tp.y);
120− fakeDragItem.Drag.hotSpot.x = fakeDragItem.width / 2
121− fakeDragItem.Drag.hotSpot.y = units.gu(2)
122− fakeDragItem.x = coords.x - fakeDragItem.Drag.hotSpot.x
123− fakeDragItem.y = coords.y - fakeDragItem.Drag.hotSpot.y
124− fakeDragItem.Drag.active = true;
125− fakeDragItem.surface = model.window.surface;
122+ var coords = mapToItem(stage, tp.x, tp.y);
123+ dragDelegate.Drag.hotSpot.x = dragDelegate.width / 2
124+ dragDelegate.Drag.hotSpot.y = units.gu(2)
125+ dragDelegate.x = coords.x - dragDelegate.Drag.hotSpot.x
126+ dragDelegate.y = coords.y - dragDelegate.Drag.hotSpot.y
127+ dragDelegate.Drag.active = true;
128+ dragDelegate.surface = model.window.surface;
126129
127130 } else {
128131 if (root.closeable) {
@@ -136,8 +139,8 @@ Item {
136139 }
137140
138141 onReleased: {
139− var result = fakeDragItem.Drag.drop();
140− fakeDragItem.surface = null;
142+ var result = dragDelegate.Drag.drop();
143+ dragDelegate.surface = null;
141144
142145 if (!d.moving) {
143146 root.clicked()
@@ -160,8 +163,8 @@ Item {
160163 }
161164
162165 onCanceled: {
163− fakeDragItem.Drag.active = false;
164− fakeDragItem.surface = null;
166+ dragDelegate.Drag.active = false;
167+ dragDelegate.surface = null;
165168 d.moving = false
166169 animation.animate("center");
167170 }
qml/Stage/Stage.qml+2
@@ -1832,6 +1832,8 @@ FocusScope {
18321832 anchors.fill: decoratedWindow
18331833 enabled: false
18341834 closeable: !appDelegate.isDash
1835+ stage: root
1836+ dragDelegate: fakeDragItem
18351837
18361838 onClicked: {
18371839 spreadItem.highlightedIndex = index;