~mzanetti/unity8/fix-left-edge-on-spread

« back to all changes in this revision

Viewing changes to qml/Stages/TabletStage.qml

  • Committer: Michael Zanetti
  • Date: 2015-01-12 11:21:17 UTC
  • mfrom: (1459.1.85 unity8)
  • Revision ID: michael.zanetti@canonical.com-20150112112117-0x9srs9dx0ndp60g
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
590
590
        width: root.dragAreaWidth
591
591
        direction: Direction.Leftwards
592
592
 
593
 
        property bool attachedToView: false
594
593
        property var gesturePoints: new Array()
595
594
 
596
595
        onTouchXChanged: {
599
598
                spreadView.contentX = -spreadView.shift;
600
599
            }
601
600
 
602
 
            if (dragging && attachedToView) {
603
 
                spreadView.contentX = -touchX + spreadDragArea.width - spreadView.shift;
604
 
                if (spreadView.shiftedContentX > spreadView.phase0Width + spreadView.phase1Width / 2) {
605
 
                    attachedToView = false;
606
 
                    spreadView.snap();
607
 
                }
 
601
            if (dragging) {
 
602
                var dragX = -touchX + spreadDragArea.width - spreadView.shift;
 
603
                var maxDrag = spreadView.width * spreadView.positionMarker4 - spreadView.shift;
 
604
                spreadView.contentX = Math.min(dragX, maxDrag);
608
605
            }
609
606
            gesturePoints.push(touchX);
610
607
        }
611
608
 
612
 
        onStatusChanged: {
613
 
            if (status == DirectionalDragArea.Recognized) {
614
 
                attachedToView = true;
615
 
            }
616
 
        }
617
 
 
618
609
        onDraggingChanged: {
619
610
            if (dragging) {
620
611
                // Gesture recognized. Start recording this gesture
630
621
                // If it was a short one-way movement, do the Alt+Tab switch
631
622
                // no matter if we didn't cross positionMarker1 yet.
632
623
                spreadView.snapTo(spreadView.nextInStack);
633
 
            } else if (!dragging && attachedToView) {
 
624
            } else if (!dragging) {
634
625
                if (spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker1) {
635
626
                    spreadView.snap();
636
627
                } else if (spreadView.shiftedContentX < spreadView.width * spreadView.positionMarker2) {