on xenial help sign in
progress -> absolute amount for the touch overlay push
commit6eab3ed47da0eba248c6663c19cdb0671d7a8130 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 30 Aug 2016, 17:09 (10 years ago) parentbb2f7b5
4 files changed+44−84
qml/Stages/DecoratedWindow.qml−9 qml/Stages/DesktopStage.qml+8−17 qml/Stages/MoveHandler.qml+28−50 qml/Stages/WindowControlsOverlay.qml+8−8
qml/Stages/DecoratedWindow.qml−9
@@ -63,15 +63,6 @@ FocusScope {
6363 signal minimizeClicked()
6464 signal decorationPressed()
6565
66− signal fakeMaximizeAnimationRequested(real progress)
67− signal fakeMaximizeLeftAnimationRequested(real progress)
68− signal fakeMaximizeRightAnimationRequested(real progress)
69− signal fakeMaximizeTopLeftAnimationRequested(real progress)
70− signal fakeMaximizeTopRightAnimationRequested(real progress)
71− signal fakeMaximizeBottomLeftAnimationRequested(real progress)
72− signal fakeMaximizeBottomRightAnimationRequested(real progress)
73− signal stopFakeAnimation()
74−
7566 signal shouldCommitSnapWindow()
7667
7768 Rectangle {
qml/Stages/DesktopStage.qml+8−17
@@ -748,15 +748,6 @@ AbstractStage {
748748 onMinimizeClicked: appDelegate.minimize()
749749 onDecorationPressed: { appDelegate.focus = true; }
750750 onShouldCommitSnapWindow: fakeRectangle.commit();
751−
752− onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(progress)
753− onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(progress)
754− onFakeMaximizeRightAnimationRequested: if (!appDelegate.maximizedRight) fakeRectangle.maximizeRight(progress)
755− onFakeMaximizeTopLeftAnimationRequested: if (!appDelegate.maximizedTopLeft) fakeRectangle.maximizeTopLeft(progress);
756− onFakeMaximizeTopRightAnimationRequested: if (!appDelegate.maximizedTopRight) fakeRectangle.maximizeTopRight(progress);
757− onFakeMaximizeBottomLeftAnimationRequested: if (!appDelegate.maximizedBottomLeft) fakeRectangle.maximizeBottomLeft(progress);
758− onFakeMaximizeBottomRightAnimationRequested: if (!appDelegate.maximizedBottomRight) fakeRectangle.maximizeBottomRight(progress);
759− onStopFakeAnimation: fakeRectangle.stop();
760751 }
761752
762753 WindowControlsOverlay {
@@ -765,14 +756,14 @@ AbstractStage {
765756 stageWidth: appContainer.width
766757 stageHeight: appContainer.height
767758
768− onFakeMaximizeAnimationRequested: decoratedWindow.fakeMaximizeAnimationRequested(progress)
769− onFakeMaximizeLeftAnimationRequested: decoratedWindow.fakeMaximizeLeftAnimationRequested(progress)
770− onFakeMaximizeRightAnimationRequested: decoratedWindow.fakeMaximizeRightAnimationRequested(progress)
771− onFakeMaximizeTopLeftAnimationRequested: decoratedWindow.fakeMaximizeTopLeftAnimationRequested(progress)
772− onFakeMaximizeTopRightAnimationRequested: decoratedWindow.fakeMaximizeTopRightAnimationRequested(progress)
773− onFakeMaximizeBottomLeftAnimationRequested: decoratedWindow.fakeMaximizeBottomLeftAnimationRequested(progress)
774− onFakeMaximizeBottomRightAnimationRequested: decoratedWindow.fakeMaximizeBottomRightAnimationRequested(progress)
775− onStopFakeAnimation: decoratedWindow.stopFakeAnimation()
759+ onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(amount)
760+ onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(amount)
761+ onFakeMaximizeRightAnimationRequested: if (!appDelegate.maximizedRight) fakeRectangle.maximizeRight(amount)
762+ onFakeMaximizeTopLeftAnimationRequested: if (!appDelegate.maximizedTopLeft) fakeRectangle.maximizeTopLeft(amount);
763+ onFakeMaximizeTopRightAnimationRequested: if (!appDelegate.maximizedTopRight) fakeRectangle.maximizeTopRight(amount);
764+ onFakeMaximizeBottomLeftAnimationRequested: if (!appDelegate.maximizedBottomLeft) fakeRectangle.maximizeBottomLeft(amount);
765+ onFakeMaximizeBottomRightAnimationRequested: if (!appDelegate.maximizedBottomRight) fakeRectangle.maximizeBottomRight(amount);
766+ onStopFakeAnimation: fakeRectangle.stop();
776767 onShouldCommitSnapWindow: fakeRectangle.commit();
777768 }
778769
qml/Stages/MoveHandler.qml+28−50
@@ -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;
qml/Stages/WindowControlsOverlay.qml+8−8
@@ -34,13 +34,13 @@ Item {
3434 readonly property alias overlayShown: overlay.visible
3535 readonly property alias moveHandler: moveHandler
3636
37− signal fakeMaximizeAnimationRequested(real progress)
38− signal fakeMaximizeLeftAnimationRequested(real progress)
39− signal fakeMaximizeRightAnimationRequested(real progress)
40− signal fakeMaximizeTopLeftAnimationRequested(real progress)
41− signal fakeMaximizeTopRightAnimationRequested(real progress)
42− signal fakeMaximizeBottomLeftAnimationRequested(real progress)
43− signal fakeMaximizeBottomRightAnimationRequested(real progress)
37+ signal fakeMaximizeAnimationRequested(real amount)
38+ signal fakeMaximizeLeftAnimationRequested(real amount)
39+ signal fakeMaximizeRightAnimationRequested(real amount)
40+ signal fakeMaximizeTopLeftAnimationRequested(real amount)
41+ signal fakeMaximizeTopRightAnimationRequested(real amount)
42+ signal fakeMaximizeBottomLeftAnimationRequested(real amount)
43+ signal fakeMaximizeBottomRightAnimationRequested(real amount)
4444 signal stopFakeAnimation()
4545 signal shouldCommitSnapWindow()
4646
@@ -146,7 +146,6 @@ Item {
146146 visible: overlay.visible
147147 enabled: visible
148148 hoverEnabled: true
149− cursorShape: moveHandler.dragging ? Qt.ClosedHandCursor : (overlay.visible ? Qt.OpenHandCursor : Qt.ArrowCursor)
150149
151150 onPressedChanged: moveHandler.handlePressedChanged(pressed, pressedButtons, mouseX, mouseY)
152151 onPositionChanged: moveHandler.handlePositionChanged(mouse)
@@ -170,6 +169,7 @@ Item {
170169 onFakeMaximizeBottomLeftAnimationRequested: root.fakeMaximizeBottomLeftAnimationRequested(progress)
171170 onFakeMaximizeBottomRightAnimationRequested: root.fakeMaximizeBottomRightAnimationRequested(progress)
172171 onStopFakeAnimation: root.stopFakeAnimation()
172+ onShouldCommitSnapWindow: root.shouldCommitSnapWindow();
173173 }
174174
175175 // dismiss area