on xenial help sign in
re-enable logic to detect one way flicks from right edge
commit96e3d944f2df4627029b50969b191033c8fd4fac authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 24 Aug 2016, 13:00 (10 years ago) parentbe7527f
1 file changed+16−25
qml/Stage/Stage.qml+16−25
qml/Stage/Stage.qml+16−25
@@ -1331,41 +1331,32 @@ AbstractStage {
13311331 // A potential edge-drag gesture has started. Start recording it
13321332 gesturePoints = [];
13331333 } else {
1334+ // Ok. The user released. Did he drag far enough to go to full spread?
13341335 if (gesturePoints[gesturePoints.length - 1] < -root.width * 0.4 ) {
13351336 print("gone to spread true")
13361337 priv.goneToSpread = true;
13371338 } else {
1338− if (appRepeater.count > 1) {
1339− print("playing focus animation for", priv.nextInStack)
1339+ // Find out if it was a one-way movement.
1340+ var oneWayFlick = true;
1341+ var smallestX = rightEdgeDragArea.width;
1342+ for (var i = 0; i < gesturePoints.length; i++) {
1343+ if (gesturePoints[i] >= smallestX) {
1344+ oneWayFlick = false;
1345+ break;
1346+ }
1347+ smallestX = gesturePoints[i];
1348+ }
1349+
1350+ if (appRepeater.count > 1 &&
1351+ (oneWayFlick && rightEdgeDragArea.distance > units.gu(2) || rightEdgeDragArea.distance > root.width * .3)) {
13401352 appRepeater.itemAt(0).playHidingAnimation()
13411353 appRepeater.itemAt(priv.nextInStack).playFocusAnimation()
13421354 } else {
13431355 appRepeater.itemAt(0).playFocusAnimation();
13441356 }
1345− }
13461357
1347−// // Ok. The user released. Find out if it was a one-way movement.
1348−// var oneWayFlick = true;
1349−// var smallestX = spreadDragArea.width;
1350−// for (var i = 0; i < gesturePoints.length; i++) {
1351−// if (gesturePoints[i] >= smallestX) {
1352−// oneWayFlick = false;
1353−// break;
1354−// }
1355−// smallestX = gesturePoints[i];
1356−// }
1357−// gesturePoints = [];
1358−
1359−// if (oneWayFlick && spreadView.shiftedContentX > units.gu(2) &&
1360−// spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width) {
1361−// // If it was a short one-way movement, do the Alt+Tab switch
1362−// // no matter if we didn't cross positionMarker1 yet.
1363−// spreadView.snapTo(1);
1364−// } else if (!dragging) {
1365−// // otherwise snap to the closest snap position we can find
1366−// // (might be back to start, to app 1 or to spread)
1367−// spreadView.snap();
1368−// }
1358+ gesturePoints = [];
1359+ }
13691360 }
13701361 }
13711362 }