on xenial help sign in
Only move the stage once an edge-drag gesture has been recognized
e4c4523Daniel d'Andrada
qml/Stages/PhoneStage.qml+12−4
@@ -430,9 +430,10 @@ Rectangle {
430 spreadView.phase = 0;
430 spreadView.phase = 0;
431 spreadView.contentX = -spreadView.shift;
431 spreadView.contentX = -spreadView.shift;
432 }
432 }
433− if (dragging && attachedToView) {
433+ if (dragging && status == DirectionalDragArea.Recognized && attachedToView) {
434 // Gesture recognized. Let's move the spreadView with the finger
434 // Gesture recognized. Let's move the spreadView with the finger
435+ var finalX = Math.min(touchX + width, width);
435− spreadView.contentX = -touchX + spreadDragArea.width - spreadView.shift;
436+ spreadView.contentX = -finalX + spreadDragArea.width - spreadView.shift;
436 }
437 }
437 if (attachedToView && spreadView.shiftedContentX >= spreadView.width * spreadView.positionMarker3) {
438 if (attachedToView && spreadView.shiftedContentX >= spreadView.width * spreadView.positionMarker3) {
438 // We passed positionMarker3. Detach from spreadView and snap it.
439 // We passed positionMarker3. Detach from spreadView and snap it.
@@ -442,7 +443,13 @@ Rectangle {
442 gesturePoints.push(touchX);
443 gesturePoints.push(touchX);
443 }
444 }
444
445
446+ property int previousStatus: -1
447+ property int currentStatus: DirectionalDragArea.WaitingForTouch
448+
445 onStatusChanged: {
449 onStatusChanged: {
450+ previousStatus = currentStatus;
451+ currentStatus = status;
452+
446 if (status == DirectionalDragArea.Recognized) {
453 if (status == DirectionalDragArea.Recognized) {
447 attachedToView = true;
454 attachedToView = true;
448 }
455 }
@@ -450,7 +457,7 @@ Rectangle {
450
457
451 onDraggingChanged: {
458 onDraggingChanged: {
452 if (dragging) {
459 if (dragging) {
453− // Gesture recognized. Start recording this gesture
460+ // A potential edge-drag gesture has started. Start recording it
454 gesturePoints = [];
461 gesturePoints = [];
455 return;
462 return;
456 }
463 }
@@ -467,7 +474,8 @@ Rectangle {
467 }
474 }
468 gesturePoints = [];
475 gesturePoints = [];
469
476
477+ if (previousStatus == DirectionalDragArea.Recognized &&
470− if (oneWayFlick && spreadView.shiftedContentX > units.gu(2) &&
478+ oneWayFlick && spreadView.shiftedContentX > units.gu(2) &&
471 spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width) {
479 spreadView.shiftedContentX < spreadView.positionMarker1 * spreadView.width) {
472 // If it was a short one-way movement, do the Alt+Tab switch
480 // If it was a short one-way movement, do the Alt+Tab switch
473 // no matter if we didn't cross positionMarker1 yet.
481 // no matter if we didn't cross positionMarker1 yet.