on xenial help sign in
add short flick gesture to quickly switch between the 2 topmost apps
commit4031f8dcb4b44846fd5fcbab3d71c842c2d95077 authorMichael Zanetti <michael.zanetti@canonical.com> dateFri 31 Jan 2014, 00:34 (13 years ago) parent7ae47fa
1 file changed+18−1
qml/Stages/PhoneStage.qml+18−1
qml/Stages/PhoneStage.qml+18−1
@@ -197,6 +197,8 @@ Item {
197197
198198 property bool attachedToView: true
199199
200+ property var gesturePoints: new Array()
201+
200202 onTouchXChanged: {
201203 if (!dragging && !priv.waitingForScreenshot) {
202204 priv.requestNewScreenshot();
@@ -210,10 +212,25 @@ Item {
210212 attachedToView = false;
211213 spreadView.snap();
212214 }
215+ gesturePoints.push(touchX)
213216 }
214217
215218 onDraggingChanged: {
216− print("Dragging changed", dragging)
219+ var oneWayFlick = true;
220+ var smallestX = spreadDragArea.width;
221+ for (var i = 0; i < gesturePoints.length; i++) {
222+ if (gesturePoints[i] >= smallestX) {
223+ oneWayFlick = false;
224+ break;
225+ }
226+ smallestX = gesturePoints[i];
227+ }
228+ gesturePoints = [];
229+
230+ if (oneWayFlick && distance < -units.gu(2) && distance > spreadView.positionMarker1 * -spreadView.width) {
231+ spreadView.snapTo(1)
232+ }
233+
217234 if (!dragging && attachedToView) {
218235 spreadView.snap();
219236 }