@@ -21,10 +21,9 @@ import "../Components/PanelState"
24 // to be set from outside
25 // to be set from outside
25 property Item target // appDelegate
26 property Item target // appDelegate
26− property Item resizeTarget // WindowResizeArea
27− property int borderThickness
29 signal activated
28 signal activated
@@ -33,7 +32,7 @@ Item {
33 anchors.fill: parent
32 anchors.fill: parent
35 // NB: for testing set to 2, not to clash with unity7 touch overlay controls
34 // NB: for testing set to 2, not to clash with unity7 touch overlay controls
36− minimumTouchPoints: 3
35+ minimumTouchPoints: 2
37 maximumTouchPoints: minimumTouchPoints
36 maximumTouchPoints: minimumTouchPoints
39 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
38 readonly property bool recognizedPress: status == TouchGestureArea.Recognized &&
@@ -53,49 +52,7 @@ Item {
54 id: overlayTimer
53 id: overlayTimer
55 interval: 2000
54 interval: 2000
56− repeat: priv.dragging || root.resizeTarget.dragging
55+ repeat: priv.dragging || (priv.resizeArea && priv.resizeArea.dragging)
62− anchors.fill: overlay
63− visible: overlay.visible
67− mouse.accepted = false;
69− propagateComposedEvents: true
75− anchors.fill: overlay
76− visible: overlay.visible
79− cursorShape: priv.dragging ? Qt.ClosedHandCursor : (overlay.visible ? Qt.OpenHandCursor : Qt.ArrowCursor)
83− var pos = mapToItem(root.target, mouseX, mouseY);
84− priv.distanceX = pos.x;
85− priv.distanceY = pos.y;
86− priv.dragging = true;
88− priv.dragging = false;
94− var pos = mapToItem(root.target.parent, mouseX, mouseY);
95− root.target.x = pos.x - priv.distanceX;
96− root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
101 QtObject {
58 QtObject {
@@ -103,6 +60,9 @@ Item {
103 property real distanceX
60 property real distanceX
104 property real distanceY
61 property real distanceY
105 property bool dragging
62 property bool dragging
64+ readonly property var resizeArea: root.target && root.target.resizeArea ? root.target.resizeArea : null
65+ readonly property int borderThickness: priv.resizeArea ? priv.resizeArea.borderThickness : 0
@@ -129,80 +89,119 @@ Item {
129 anchors.centerIn: parent
89 anchors.centerIn: parent
130 opacity: 0.95
90 opacity: 0.95
131 visible: target && target.width > units.gu(12) && target.height > units.gu(12)
91 visible: target && target.width > units.gu(12) && target.height > units.gu(12)
96+ visible: overlay.visible
99+ cursorShape: priv.dragging ? Qt.ClosedHandCursor : (overlay.visible ? Qt.OpenHandCursor : Qt.ArrowCursor)
103+ var pos = mapToItem(root.target, mouseX, mouseY);
104+ priv.distanceX = pos.x;
105+ priv.distanceY = pos.y;
106+ priv.dragging = true;
108+ priv.dragging = false;
112+ onPositionChanged: {
113+ if (priv.dragging) {
114+ var pos = mapToItem(root.target.parent, mouseX, mouseY);
115+ root.target.x = pos.x - priv.distanceX;
116+ root.target.y = Math.max(pos.y - priv.distanceY, PanelState.panelHeight);
123+ anchors.fill: parent
124+ visible: overlay.visible
127+ overlayTimer.stop();
128+ mouse.accepted = false;
134 ResizeGrip { // top left
133 ResizeGrip { // top left
135 anchors.horizontalCenter: parent.left
134 anchors.horizontalCenter: parent.left
136− anchors.horizontalCenterOffset: borderThickness
135+ //anchors.horizontalCenterOffset: priv.borderThickness
137 anchors.verticalCenter: parent.top
136 anchors.verticalCenter: parent.top
138− anchors.verticalCenterOffset: borderThickness
137+ //anchors.verticalCenterOffset: priv.borderThickness
139 visible: !overlay.anyMaximized
138 visible: !overlay.anyMaximized
140− resizeTarget: root.resizeTarget
139+ resizeTarget: priv.resizeArea
143 ResizeGrip { // top center
142 ResizeGrip { // top center
144 anchors.horizontalCenter: parent.horizontalCenter
143 anchors.horizontalCenter: parent.horizontalCenter
145 anchors.verticalCenter: parent.top
144 anchors.verticalCenter: parent.top
146− anchors.verticalCenterOffset: borderThickness
145+ //anchors.verticalCenterOffset: priv.borderThickness
147 rotation: 45
146 rotation: 45
148 visible: !overlay.anyMaximized
147 visible: !overlay.anyMaximized
149− resizeTarget: root.resizeTarget
148+ resizeTarget: priv.resizeArea
152 ResizeGrip { // top right
151 ResizeGrip { // top right
153 anchors.horizontalCenter: parent.right
152 anchors.horizontalCenter: parent.right
154− anchors.horizontalCenterOffset: -borderThickness
153+ //anchors.horizontalCenterOffset: -priv.borderThickness
155 anchors.verticalCenter: parent.top
154 anchors.verticalCenter: parent.top
156− anchors.verticalCenterOffset: borderThickness
155+ //anchors.verticalCenterOffset: priv.borderThickness
157 rotation: 90
156 rotation: 90
158 visible: !overlay.anyMaximized
157 visible: !overlay.anyMaximized
159− resizeTarget: root.resizeTarget
158+ resizeTarget: priv.resizeArea
162 ResizeGrip { // right
161 ResizeGrip { // right
163 anchors.horizontalCenter: parent.right
162 anchors.horizontalCenter: parent.right
164− anchors.horizontalCenterOffset: -borderThickness
163+ //anchors.horizontalCenterOffset: -priv.borderThickness
165 anchors.verticalCenter: parent.verticalCenter
164 anchors.verticalCenter: parent.verticalCenter
166 rotation: 135
165 rotation: 135
167 visible: target && !target.maximizedRight && !target.maximized
166 visible: target && !target.maximizedRight && !target.maximized
168− resizeTarget: root.resizeTarget
167+ resizeTarget: priv.resizeArea
171 ResizeGrip { // bottom right
170 ResizeGrip { // bottom right
172 anchors.horizontalCenter: parent.right
171 anchors.horizontalCenter: parent.right
173− anchors.horizontalCenterOffset: -borderThickness
172+ //anchors.horizontalCenterOffset: -priv.borderThickness
174 anchors.verticalCenter: parent.bottom
173 anchors.verticalCenter: parent.bottom
175− anchors.verticalCenterOffset: -borderThickness
174+ //anchors.verticalCenterOffset: -priv.borderThickness
176 visible: !overlay.anyMaximized
175 visible: !overlay.anyMaximized
177− resizeTarget: root.resizeTarget
176+ resizeTarget: priv.resizeArea
180 ResizeGrip { // bottom center
179 ResizeGrip { // bottom center
181 anchors.horizontalCenter: parent.horizontalCenter
180 anchors.horizontalCenter: parent.horizontalCenter
182 anchors.verticalCenter: parent.bottom
181 anchors.verticalCenter: parent.bottom
183− anchors.verticalCenterOffset: -borderThickness
182+ //anchors.verticalCenterOffset: -priv.borderThickness
184 rotation: 45
183 rotation: 45
185 visible: !overlay.anyMaximized
184 visible: !overlay.anyMaximized
186− resizeTarget: root.resizeTarget
185+ resizeTarget: priv.resizeArea
189 ResizeGrip { // bottom left
188 ResizeGrip { // bottom left
190 anchors.horizontalCenter: parent.left
189 anchors.horizontalCenter: parent.left
191− anchors.horizontalCenterOffset: borderThickness
190+ //anchors.horizontalCenterOffset: priv.borderThickness
192 anchors.verticalCenter: parent.bottom
191 anchors.verticalCenter: parent.bottom
193− anchors.verticalCenterOffset: -borderThickness
192+ //anchors.verticalCenterOffset: -priv.borderThickness
194 rotation: 90
193 rotation: 90
195 visible: !overlay.anyMaximized
194 visible: !overlay.anyMaximized
196− resizeTarget: root.resizeTarget
195+ resizeTarget: priv.resizeArea
199 ResizeGrip { // left
198 ResizeGrip { // left
200 anchors.horizontalCenter: parent.left
199 anchors.horizontalCenter: parent.left
201− anchors.horizontalCenterOffset: borderThickness
200+ //anchors.horizontalCenterOffset: priv.borderThickness
202 anchors.verticalCenter: parent.verticalCenter
201 anchors.verticalCenter: parent.verticalCenter
203 rotation: 135
202 rotation: 135
204 visible: target && !target.maximizedLeft && !target.maximized
203 visible: target && !target.maximizedLeft && !target.maximized
205− resizeTarget: root.resizeTarget
204+ resizeTarget: priv.resizeArea