on xenial help sign in
fix touch dragging \o/
4ae834fLukáš Tinkl
qml/Stages/DesktopStage.qml+7−7
@@ -756,13 +756,13 @@ AbstractStage {
756 stageWidth: appContainer.width
756 stageWidth: appContainer.width
757 stageHeight: appContainer.height
757 stageHeight: appContainer.height
758
758
759− onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(amount)
759+ onFakeMaximizeAnimationRequested: if (!appDelegate.maximized) fakeRectangle.maximize(amount, true)
760− onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(amount)
760+ onFakeMaximizeLeftAnimationRequested: if (!appDelegate.maximizedLeft) fakeRectangle.maximizeLeft(amount, true)
761− onFakeMaximizeRightAnimationRequested: if (!appDelegate.maximizedRight) fakeRectangle.maximizeRight(amount)
761+ onFakeMaximizeRightAnimationRequested: if (!appDelegate.maximizedRight) fakeRectangle.maximizeRight(amount, true)
762− onFakeMaximizeTopLeftAnimationRequested: if (!appDelegate.maximizedTopLeft) fakeRectangle.maximizeTopLeft(amount);
762+ onFakeMaximizeTopLeftAnimationRequested: if (!appDelegate.maximizedTopLeft) fakeRectangle.maximizeTopLeft(amount, true);
763− onFakeMaximizeTopRightAnimationRequested: if (!appDelegate.maximizedTopRight) fakeRectangle.maximizeTopRight(amount);
763+ onFakeMaximizeTopRightAnimationRequested: if (!appDelegate.maximizedTopRight) fakeRectangle.maximizeTopRight(amount, true);
764− onFakeMaximizeBottomLeftAnimationRequested: if (!appDelegate.maximizedBottomLeft) fakeRectangle.maximizeBottomLeft(amount);
764+ onFakeMaximizeBottomLeftAnimationRequested: if (!appDelegate.maximizedBottomLeft) fakeRectangle.maximizeBottomLeft(amount, true);
765− onFakeMaximizeBottomRightAnimationRequested: if (!appDelegate.maximizedBottomRight) fakeRectangle.maximizeBottomRight(amount);
765+ onFakeMaximizeBottomRightAnimationRequested: if (!appDelegate.maximizedBottomRight) fakeRectangle.maximizeBottomRight(amount, true);
766 onStopFakeAnimation: fakeRectangle.stop();
766 onStopFakeAnimation: fakeRectangle.stop();
767 onShouldCommitSnapWindow: fakeRectangle.commit();
767 onShouldCommitSnapWindow: fakeRectangle.commit();
768 }
768 }
qml/Stages/FakeMaximizeDelegate.qml+25−17
@@ -41,7 +41,7 @@ Rectangle {
41
41
42 // Edge push progress
42 // Edge push progress
43 // Value range is [0.0, 1.0]
43 // Value range is [0.0, 1.0]
44− readonly property real progress: MathUtils.clamp(priv.accumulatedPush / EdgeBarrierSettings.pushThreshold, 0.0, 1.0)
44+ readonly property real progress: priv.directProgress != -1 ? priv.directProgress : priv.accumulatedProgress
45 onProgressChanged: {
45 onProgressChanged: {
46 print("!!! Progress:", progress)
46 print("!!! Progress:", progress)
47 }
47 }
@@ -51,6 +51,8 @@ Rectangle {
51 QtObject {
51 QtObject {
52 id: priv
52 id: priv
53
53
54+ readonly property real accumulatedProgress: MathUtils.clamp(accumulatedPush / EdgeBarrierSettings.pushThreshold, 0.0, 1.0)
55+ property real directProgress: -1
54 property real accumulatedPush: 0
56 property real accumulatedPush: 0
55
57
56 function push(amount) {
58 function push(amount) {
@@ -85,8 +87,13 @@ Rectangle {
85 fakeRectangle.transformOrigin = edge;
87 fakeRectangle.transformOrigin = edge;
86 }
88 }
87
89
88− function processAnimation(amount, animation) {
90+ function processAnimation(amount, animation, isProgress) {
91+ if (isProgress) {
92+ priv.directProgress = amount;
93+ } else {
94+ priv.directProgress = -1;
89− priv.push(amount);
95+ priv.push(amount);
96+ }
90
97
91 if (progress > hintThreshold) { // above 10% we start the full preview animation
98 if (progress > hintThreshold) { // above 10% we start the full preview animation
92 animation.start();
99 animation.start();
@@ -121,56 +128,57 @@ Rectangle {
121 function stop() {
128 function stop() {
122 print("!!! Stop")
129 print("!!! Stop")
123 priv.accumulatedPush = 0;
130 priv.accumulatedPush = 0;
131+ priv.directProgress = -1;
124 edge = -1;
132 edge = -1;
125 }
133 }
126
134
127− function maximize(amount) {
135+ function maximize(amount, isProgress) {
128 if (fakeRectangle.edge != Item.Top) {
136 if (fakeRectangle.edge != Item.Top) {
129 priv.setup(Item.Top);
137 priv.setup(Item.Top);
130 }
138 }
131− priv.processAnimation(amount, fakeMaximizeAnimation);
139+ priv.processAnimation(amount, fakeMaximizeAnimation, isProgress);
132 }
140 }
133
141
134− function maximizeLeft(amount) {
142+ function maximizeLeft(amount, isProgress) {
135 if (fakeRectangle.edge != Item.Left) {
143 if (fakeRectangle.edge != Item.Left) {
136 priv.setup(Item.Left);
144 priv.setup(Item.Left);
137 }
145 }
138− priv.processAnimation(amount, fakeMaximizeLeftAnimation);
146+ priv.processAnimation(amount, fakeMaximizeLeftAnimation, isProgress);
139 }
147 }
140
148
141− function maximizeRight(amount) {
149+ function maximizeRight(amount, isProgress) {
142 if (fakeRectangle.edge != Item.Right) {
150 if (fakeRectangle.edge != Item.Right) {
143 priv.setup(Item.Right);
151 priv.setup(Item.Right);
144 }
152 }
145− priv.processAnimation(amount, fakeMaximizeRightAnimation);
153+ priv.processAnimation(amount, fakeMaximizeRightAnimation, isProgress);
146 }
154 }
147
155
148− function maximizeTopLeft(amount) {
156+ function maximizeTopLeft(amount, isProgress) {
149 if (fakeRectangle.edge != Item.TopLeft) {
157 if (fakeRectangle.edge != Item.TopLeft) {
150 priv.setup(Item.TopLeft);
158 priv.setup(Item.TopLeft);
151 }
159 }
152− priv.processAnimation(amount, fakeMaximizeTopLeftAnimation);
160+ priv.processAnimation(amount, fakeMaximizeTopLeftAnimation, isProgress);
153 }
161 }
154
162
155− function maximizeTopRight(amount) {
163+ function maximizeTopRight(amount, isProgress) {
156 if (fakeRectangle.edge != Item.TopRight) {
164 if (fakeRectangle.edge != Item.TopRight) {
157 priv.setup(Item.TopRight);
165 priv.setup(Item.TopRight);
158 }
166 }
159− priv.processAnimation(amount, fakeMaximizeTopRightAnimation);
167+ priv.processAnimation(amount, fakeMaximizeTopRightAnimation, isProgress);
160 }
168 }
161
169
162− function maximizeBottomLeft(amount) {
170+ function maximizeBottomLeft(amount, isProgress) {
163 if (fakeRectangle.edge != Item.BottomLeft) {
171 if (fakeRectangle.edge != Item.BottomLeft) {
164 priv.setup(Item.BottomLeft);
172 priv.setup(Item.BottomLeft);
165 }
173 }
166− priv.processAnimation(amount, fakeMaximizeBottomLeftAnimation);
174+ priv.processAnimation(amount, fakeMaximizeBottomLeftAnimation, isProgress);
167 }
175 }
168
176
169− function maximizeBottomRight(amount) {
177+ function maximizeBottomRight(amount, isProgress) {
170 if (fakeRectangle.edge != Item.BottomRight) {
178 if (fakeRectangle.edge != Item.BottomRight) {
171 priv.setup(Item.BottomRight);
179 priv.setup(Item.BottomRight);
172 }
180 }
173− priv.processAnimation(amount, fakeMaximizeBottomRightAnimation);
181+ priv.processAnimation(amount, fakeMaximizeBottomRightAnimation, isProgress);
174 }
182 }
175
183
176 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
184 Behavior on opacity { UbuntuNumberAnimation { duration: UbuntuAnimation.BriskDuration } }
qml/Stages/MoveHandler.qml+17−18
@@ -119,46 +119,45 @@ Item {
119 target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
119 target.requestedY = Math.round(Math.max(pos.y - priv.distanceY, PanelState.panelHeight));
120
120
121 if (sensingPoints) { // edge/corner detection when dragging via the touch overlay
121 if (sensingPoints) { // edge/corner detection when dragging via the touch overlay
122− if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight
122+ if (sensingPoints.topLeft.x < priv.triggerArea && sensingPoints.topLeft.y < PanelState.panelHeight + priv.triggerArea
123 && target.canBeCornerMaximized) { // top left
123 && target.canBeCornerMaximized) { // top left
124− priv.progress = priv.progressInCorner(0, PanelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y) - priv.progress;
124+ priv.progress = priv.progressInCorner(0, PanelState.panelHeight, sensingPoints.topLeft.x, sensingPoints.topLeft.y);
125 priv.resetEdges();
125 priv.resetEdges();
126 priv.nearTopLeftCorner = true;
126 priv.nearTopLeftCorner = true;
127− root.fakeMaximizeTopLeftAnimationRequested(priv.progress * priv.triggerArea);
127+ root.fakeMaximizeTopLeftAnimationRequested(priv.progress);
128− } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && sensingPoints.topRight.y < PanelState.panelHeight
128+ } else if (sensingPoints.topRight.x > stageWidth - priv.triggerArea && sensingPoints.topRight.y < PanelState.panelHeight + priv.triggerArea
129 && target.canBeCornerMaximized) { // top right
129 && target.canBeCornerMaximized) { // top right
130− priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y) - priv.progress;
130+ priv.progress = priv.progressInCorner(stageWidth, PanelState.panelHeight, sensingPoints.topRight.x, sensingPoints.topRight.y);
131 priv.resetEdges();
131 priv.resetEdges();
132 priv.nearTopRightCorner = true;
132 priv.nearTopRightCorner = true;
133− root.fakeMaximizeTopRightAnimationRequested(priv.progress * priv.triggerArea);
133+ root.fakeMaximizeTopRightAnimationRequested(priv.progress);
134 } else if (sensingPoints.bottomLeft.x < priv.triggerArea && sensingPoints.bottomLeft.y > stageHeight - priv.triggerArea
134 } else if (sensingPoints.bottomLeft.x < priv.triggerArea && sensingPoints.bottomLeft.y > stageHeight - priv.triggerArea
135 && target.canBeCornerMaximized) { // bottom left
135 && target.canBeCornerMaximized) { // bottom left
136− priv.progress = priv.progressInCorner(0, stageHeight, sensingPoints.bottomLeft.x, sensingPoints.bottomLeft.y) - priv.progress;
136+ priv.progress = priv.progressInCorner(0, stageHeight, sensingPoints.bottomLeft.x, sensingPoints.bottomLeft.y);
137 priv.resetEdges();
137 priv.resetEdges();
138 priv.nearBottomLeftCorner = true;
138 priv.nearBottomLeftCorner = true;
139− root.fakeMaximizeBottomLeftAnimationRequested(priv.progress * priv.triggerArea);
139+ root.fakeMaximizeBottomLeftAnimationRequested(priv.progress);
140 } else if (sensingPoints.bottomRight.x > stageWidth - priv.triggerArea && sensingPoints.bottomRight.y > stageHeight - priv.triggerArea
140 } else if (sensingPoints.bottomRight.x > stageWidth - priv.triggerArea && sensingPoints.bottomRight.y > stageHeight - priv.triggerArea
141 && target.canBeCornerMaximized) { // bottom right
141 && target.canBeCornerMaximized) { // bottom right
142− priv.progress = priv.progressInCorner(stageWidth, stageHeight, sensingPoints.bottomRight.x, sensingPoints.bottomRight.y) - priv.progress;
142+ priv.progress = priv.progressInCorner(stageWidth, stageHeight, sensingPoints.bottomRight.x, sensingPoints.bottomRight.y);
143 priv.resetEdges();
143 priv.resetEdges();
144 priv.nearBottomRightCorner = true;
144 priv.nearBottomRightCorner = true;
145− root.fakeMaximizeBottomRightAnimationRequested(priv.progress * priv.triggerArea);
145+ root.fakeMaximizeBottomRightAnimationRequested(priv.progress);
146 } else if (sensingPoints.left.x < priv.triggerArea && target.canBeMaximizedLeftRight) { // left
146 } else if (sensingPoints.left.x < priv.triggerArea && target.canBeMaximizedLeftRight) { // left
147− priv.progress = MathUtils.clampAndProject(sensingPoints.left.x, priv.triggerArea, 0, 0, 1) - priv.progress;
147+ priv.progress = MathUtils.clampAndProject(sensingPoints.left.x, priv.triggerArea, 0, 0, 1);
148 priv.resetEdges();
148 priv.resetEdges();
149 priv.nearLeftEdge = true;
149 priv.nearLeftEdge = true;
150− root.fakeMaximizeLeftAnimationRequested(priv.progress * priv.triggerArea);
150+ root.fakeMaximizeLeftAnimationRequested(priv.progress);
151 } else if (sensingPoints.right.x > stageWidth - priv.triggerArea && target.canBeMaximizedLeftRight) { // right
151 } else if (sensingPoints.right.x > stageWidth - priv.triggerArea && target.canBeMaximizedLeftRight) { // right
152− priv.progress = MathUtils.clampAndProject(sensingPoints.right.x, stageWidth - priv.triggerArea, stageWidth, 0, 1) - priv.progress;
152+ priv.progress = MathUtils.clampAndProject(sensingPoints.right.x, stageWidth - priv.triggerArea, stageWidth, 0, 1);
153 priv.resetEdges();
153 priv.resetEdges();
154 priv.nearRightEdge = true;
154 priv.nearRightEdge = true;
155− root.fakeMaximizeRightAnimationRequested(priv.progress * priv.triggerArea);
155+ root.fakeMaximizeRightAnimationRequested(priv.progress);
156− } else if (sensingPoints.top.y < PanelState.panelHeight && target.canBeMaximized) { // top
156+ } else if (sensingPoints.top.y < PanelState.panelHeight + priv.triggerArea && target.canBeMaximized) { // top
157− priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, Math.max(PanelState.panelHeight, priv.triggerArea), 0, 0, 1) - priv.progress;
157+ priv.progress = MathUtils.clampAndProject(sensingPoints.top.y, PanelState.panelHeight + priv.triggerArea, 0, 0, 1);
158 priv.resetEdges();
158 priv.resetEdges();
159 priv.nearTopEdge = true;
159 priv.nearTopEdge = true;
160− root.fakeMaximizeAnimationRequested(priv.progress * priv.triggerArea);
160+ root.fakeMaximizeAnimationRequested(priv.progress);
161− priv.progress = tmpProgress;
162 } else if (priv.nearLeftEdge || priv.nearRightEdge || priv.nearTopEdge || priv.nearTopLeftCorner || priv.nearTopRightCorner ||
161 } else if (priv.nearLeftEdge || priv.nearRightEdge || priv.nearTopEdge || priv.nearTopLeftCorner || priv.nearTopRightCorner ||
163 priv.nearBottomLeftCorner || priv.nearBottomRightCorner) {
162 priv.nearBottomLeftCorner || priv.nearBottomRightCorner) {
164 print("!!! Exited")
163 print("!!! Exited")
qml/Stages/WindowControlsOverlay.qml+7−7
@@ -161,13 +161,13 @@ Item {
161 objectName: "moveHandler"
161 objectName: "moveHandler"
162 target: root.target
162 target: root.target
163
163
164− onFakeMaximizeAnimationRequested: root.fakeMaximizeAnimationRequested(progress)
164+ onFakeMaximizeAnimationRequested: root.fakeMaximizeAnimationRequested(amount)
165− onFakeMaximizeLeftAnimationRequested: root.fakeMaximizeLeftAnimationRequested(progress)
165+ onFakeMaximizeLeftAnimationRequested: root.fakeMaximizeLeftAnimationRequested(amount)
166− onFakeMaximizeRightAnimationRequested: root.fakeMaximizeRightAnimationRequested(progress)
166+ onFakeMaximizeRightAnimationRequested: root.fakeMaximizeRightAnimationRequested(amount)
167− onFakeMaximizeTopLeftAnimationRequested: root.fakeMaximizeTopLeftAnimationRequested(progress)
167+ onFakeMaximizeTopLeftAnimationRequested: root.fakeMaximizeTopLeftAnimationRequested(amount)
168− onFakeMaximizeTopRightAnimationRequested: root.fakeMaximizeTopRightAnimationRequested(progress)
168+ onFakeMaximizeTopRightAnimationRequested: root.fakeMaximizeTopRightAnimationRequested(amount)
169− onFakeMaximizeBottomLeftAnimationRequested: root.fakeMaximizeBottomLeftAnimationRequested(progress)
169+ onFakeMaximizeBottomLeftAnimationRequested: root.fakeMaximizeBottomLeftAnimationRequested(amount)
170− onFakeMaximizeBottomRightAnimationRequested: root.fakeMaximizeBottomRightAnimationRequested(progress)
170+ onFakeMaximizeBottomRightAnimationRequested: root.fakeMaximizeBottomRightAnimationRequested(amount)
171 onStopFakeAnimation: root.stopFakeAnimation()
171 onStopFakeAnimation: root.stopFakeAnimation()
172 onShouldCommitSnapWindow: root.shouldCommitSnapWindow();
172 onShouldCommitSnapWindow: root.shouldCommitSnapWindow();
173 }
173 }