@@ -31,13 +31,13 @@ Item {
3131
3232 readonly property alias dragging: priv.dragging
3333
34− signal fakeMaximizeAnimationRequested(real progress)
35− signal fakeMaximizeLeftAnimationRequested(real progress)
36− signal fakeMaximizeRightAnimationRequested(real progress)
37− signal fakeMaximizeTopLeftAnimationRequested(real progress)
38− signal fakeMaximizeTopRightAnimationRequested(real progress)
39− signal fakeMaximizeBottomLeftAnimationRequested(real progress)
40− signal fakeMaximizeBottomRightAnimationRequested(real progress)
34+ signal fakeMaximizeAnimationRequested(real amount)
35+ signal fakeMaximizeLeftAnimationRequested(real amount)
36+ signal fakeMaximizeRightAnimationRequested(real amount)
37+ signal fakeMaximizeTopLeftAnimationRequested(real amount)
38+ signal fakeMaximizeTopRightAnimationRequested(real amount)
39+ signal fakeMaximizeBottomLeftAnimationRequested(real amount)
40+ signal fakeMaximizeBottomRightAnimationRequested(real amount)
4141 signal stopFakeAnimation()
4242
4343 signal shouldCommitSnapWindow()
@@ -118,47 +118,47 @@ Item {
118118 target.requestedX = Math.round(pos.x - priv.distanceX);
119119 target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
120120
121− if (sensingPoints) {
122− print("!!! Detecting edges/corners in touch mode")
121+ if (sensingPoints) { // edge/corner detection when dragging via the touch overlay
123122 if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight
124123 && target.canBeCornerMaximized) { // top left
125− priv.progress = priv.progressInCorner(0, PanelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y);
124+ priv.progress = priv.progressInCorner(0, PanelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y) - priv.progress;
126125 priv.resetEdges();
127126 priv.nearTopLeftCorner = true;
128− root.fakeMaximizeTopLeftAnimationRequested(priv.progress);
127+ root.fakeMaximizeTopLeftAnimationRequested(priv.progress * priv.triggerArea);
129128 } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && sensingPoints.topRight.y < PanelState.panelHeight
130129 && target.canBeCornerMaximized) { // top right
131− priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y);
130+ priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y) - priv.progress;
132131 priv.resetEdges();
133132 priv.nearTopRightCorner = true;
134− root.fakeMaximizeTopRightAnimationRequested(priv.progress);
133+ root.fakeMaximizeTopRightAnimationRequested(priv.progress * priv.triggerArea);
135134 } else if (sensingPoints.bottomLeft.x < priv.triggerArea && sensingPoints.bottomLeft.y > stageHeight - priv.triggerArea
136135 && target.canBeCornerMaximized) { // bottom left
137− priv.progress = priv.progressInCorner(0, stageHeight, sensingPoints.bottomLeft.x, sensingPoints.bottomLeft.y);
136+ priv.progress = priv.progressInCorner(0, stageHeight, sensingPoints.bottomLeft.x, sensingPoints.bottomLeft.y) - priv.progress;
138137 priv.resetEdges();
139138 priv.nearBottomLeftCorner = true;
140− root.fakeMaximizeBottomLeftAnimationRequested(priv.progress);
139+ root.fakeMaximizeBottomLeftAnimationRequested(priv.progress * priv.triggerArea);
141140 } else if (sensingPoints.bottomRight.x > stageWidth - priv.triggerArea && sensingPoints.bottomRight.y > stageHeight - priv.triggerArea
142141 && target.canBeCornerMaximized) { // bottom right
143− priv.progress = priv.progressInCorner(stageWidth, stageHeight, sensingPoints.bottomRight.x, sensingPoints.bottomRight.y);
142+ priv.progress = priv.progressInCorner(stageWidth, stageHeight, sensingPoints.bottomRight.x, sensingPoints.bottomRight.y) - priv.progress;
144143 priv.resetEdges();
145144 priv.nearBottomRightCorner = true;
146− root.fakeMaximizeBottomRightAnimationRequested(priv.progress);
145+ root.fakeMaximizeBottomRightAnimationRequested(priv.progress * priv.triggerArea);
147146 } else if (sensingPoints.left.x < priv.triggerArea && target.canBeMaximizedLeftRight) { // left
148− priv.progress = MathUtils.clampAndProject(sensingPoints.left.x, priv.triggerArea, 0, 0, 1);
147+ priv.progress = MathUtils.clampAndProject(sensingPoints.left.x, priv.triggerArea, 0, 0, 1) - priv.progress;
149148 priv.resetEdges();
150149 priv.nearLeftEdge = true;
151− root.fakeMaximizeLeftAnimationRequested(priv.progress);
150+ root.fakeMaximizeLeftAnimationRequested(priv.progress * priv.triggerArea);
152151 } else if (sensingPoints.right.x > stageWidth - priv.triggerArea && target.canBeMaximizedLeftRight) { // right
153− priv.progress = MathUtils.clampAndProject(sensingPoints.right.x, stageWidth - priv.triggerArea, stageWidth, 0, 1);
152+ priv.progress = MathUtils.clampAndProject(sensingPoints.right.x, stageWidth - priv.triggerArea, stageWidth, 0, 1) - priv.progress;
154153 priv.resetEdges();
155154 priv.nearRightEdge = true;
156− root.fakeMaximizeRightAnimationRequested(priv.progress);
155+ root.fakeMaximizeRightAnimationRequested(priv.progress * priv.triggerArea);
157156 } else if (sensingPoints.top.y < PanelState.panelHeight && target.canBeMaximized) { // top
158− priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1);
157+ priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1) - priv.progress;
159158 priv.resetEdges();
160159 priv.nearTopEdge = true;
161− root.fakeMaximizeAnimationRequested(priv.progress);
160+ root.fakeMaximizeAnimationRequested(priv.progress * priv.triggerArea);
161+ priv.progress = tmpProgress;
162162 } else if (priv.nearLeftEdge || priv.nearRightEdge || priv.nearTopEdge || priv.nearTopLeftCorner || priv.nearTopRightCorner ||
163163 priv.nearBottomLeftCorner || priv.nearBottomRightCorner) {
164164 print("!!! Exited")
@@ -172,33 +172,11 @@ Item {
172172
173173 function handleReleased(touchMode) {
174174 if (touchMode) {
175− if (priv.progress < 0.3) { // cancel the preview shape if under 30%
176− priv.progress = 0;
177− priv.resetEdges();
178− root.stopFakeAnimation();
179− } else if (priv.nearLeftEdge) {
180− target.maximizeLeft();
181− priv.resetEdges();
182− } else if (priv.nearTopEdge) {
183− target.maximize();
184− priv.resetEdges();
185− } else if (priv.nearRightEdge) {
186− target.maximizeRight();
187− priv.resetEdges();
188− } else if (priv.nearTopLeftCorner) {
189− target.maximizeTopLeft();
190− priv.resetEdges();
191− } else if (priv.nearTopRightCorner) {
192− target.maximizeTopRight();
193− priv.resetEdges();
194− } else if (priv.nearBottomLeftCorner) {
195− target.maximizeBottomLeft();
196− priv.resetEdges();
197− } else if (priv.nearBottomRightCorner) {
198− target.maximizeBottomRight();
199− priv.resetEdges();
200− }
201− } else if ((target.state == "normal" || target.state == "restored") && priv.progress == 0) {
175+ root.shouldCommitSnapWindow();
176+ priv.progress = 0;
177+ priv.resetEdges();
178+ }
179+ if ((target.state == "normal" || target.state == "restored") && priv.progress == 0) {
202180 // save the x/y to restore to
203181 print("!!! Saving restoredX/Y")
204182 target.restoredX = target.x;