@@ -145,16 +145,16 @@ Rectangle {
146 // Those markers mark the various positions in the spread (ratio to screen width from right to left):
146 // Those markers mark the various positions in the spread (ratio to screen width from right to left):
147 // 0 - 1: following finger, snap back to the beginning on release
147 // 0 - 1: following finger, snap back to the beginning on release
148− property real positionMarker1: 0.3
148+ property real positionMarker1: 0.2
149 // 1 - 2: curved snapping movement, snap to app 1 on release
149 // 1 - 2: curved snapping movement, snap to app 1 on release
150− property real positionMarker2: 0.45
150+ property real positionMarker2: 0.3
151 // 2 - 3: movement follows finger, snaps back to app 1 on release
151 // 2 - 3: movement follows finger, snaps back to app 1 on release
152− property real positionMarker3: 0.6
152+ property real positionMarker3: 0.35
153 // passing 3, we detach movement from the finger and snap to 4
153 // passing 3, we detach movement from the finger and snap to 4
154 property real positionMarker4: 0.9
154 property real positionMarker4: 0.9
156 // This is where the first app snaps to when bringing it in from the right edge.
156 // This is where the first app snaps to when bringing it in from the right edge.
157− property real snapPosition: 0.75
157+ property real snapPosition: 0.7
159 // Phase of the animation:
159 // Phase of the animation:
160 // 0: Starting from right edge, a new app (index 1) comes in from the right
160 // 0: Starting from right edge, a new app (index 1) comes in from the right
@@ -178,7 +178,7 @@ Rectangle {
179 if (shiftedContentX < width * positionMarker2) {
179 if (shiftedContentX < width * positionMarker2) {
180 phase = 0;
180 phase = 0;
181− } else if (shiftedContentX >= width * positionMarker4) {
181+ } else if (shiftedContentX >= width * positionMarker4 && !spreadDragArea.dragging) {
182 phase = 2;
182 phase = 2;
@@ -270,6 +270,7 @@ Rectangle {
271 Repeater {
271 Repeater {
272 id: spreadRepeater
272 id: spreadRepeater
273+ objectName: "spreadRepeater"
273 model: ApplicationManager
274 model: ApplicationManager
274 delegate: TransformedSpreadDelegate {
275 delegate: TransformedSpreadDelegate {
275 id: appDelegate
276 id: appDelegate
@@ -286,7 +287,7 @@ Rectangle {
286 otherSelected: spreadView.selectedIndex >= 0 && !selected
287 otherSelected: spreadView.selectedIndex >= 0 && !selected
287 interactive: !spreadView.interactive && spreadView.phase === 0
288 interactive: !spreadView.interactive && spreadView.phase === 0
288 && spreadView.shiftedContentX === 0 && root.interactive && index === 0
289 && spreadView.shiftedContentX === 0 && root.interactive && index === 0
289− swipeToCloseEnabled: spreadView.interactive
290+ swipeToCloseEnabled: spreadView.interactive && !snapAnimation.running
290 maximizedAppTopMargin: root.maximizedAppTopMargin
291 maximizedAppTopMargin: root.maximizedAppTopMargin
291 dropShadow: spreadView.active ||
292 dropShadow: spreadView.active ||
292 (priv.focusedAppDelegate && priv.focusedAppDelegate.x !== 0)
293 (priv.focusedAppDelegate && priv.focusedAppDelegate.x !== 0)
@@ -367,8 +368,9 @@ Rectangle {
367 if (spreadView.phase == 0 && index < 2) {
368 if (spreadView.phase == 0 && index < 2) {
368 if (progress < spreadView.positionMarker1) {
369 if (progress < spreadView.positionMarker1) {
369 return progress;
370 return progress;
370− } else if (progress < spreadView.positionMarker1 + snappingCurve.period){
371+ } else if (progress < spreadView.positionMarker1 + 0.05){
371− return spreadView.positionMarker1 + snappingCurve.value * 3;
372+ // p : 0.05 = x : pm2
373+ return spreadView.positionMarker1 + (progress - spreadView.positionMarker1) * (spreadView.positionMarker2 - spreadView.positionMarker1) / 0.05
373 return spreadView.positionMarker2;
375 return spreadView.positionMarker2;
@@ -380,13 +382,6 @@ Rectangle {
380 visible: (progress >= 0 && progress < 1.7) ||
382 visible: (progress >= 0 && progress < 1.7) ||
381 (isDash && priv.focusedAppDelegate.x !== 0)
383 (isDash && priv.focusedAppDelegate.x !== 0)
385− type: EasingCurve.Linear
387− progress: appDelegate.progress - spreadView.positionMarker1
390 Binding {
385 Binding {
391 target: appDelegate
386 target: appDelegate
392 property: "orientation"
387 property: "orientation"
@@ -425,16 +420,11 @@ Rectangle {
425 id: spreadDragArea
420 id: spreadDragArea
426 objectName: "spreadDragArea"
421 objectName: "spreadDragArea"
427 direction: Direction.Leftwards
422 direction: Direction.Leftwards
428− enabled: spreadView.phase != 2 && root.spreadEnabled
423+ enabled: (spreadView.phase != 2 && root.spreadEnabled) || dragging
430 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
425 anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
431 width: root.dragAreaWidth
426 width: root.dragAreaWidth
433− // Sitting at the right edge of the screen, this EdgeDragArea directly controls the spreadView when
434− // attachedToView is true. When the finger movement passes positionMarker3 we detach it from the
435− // spreadView and make the spreadView snap to positionMarker4.
436− property bool attachedToView: true
438 property var gesturePoints: new Array()
428 property var gesturePoints: new Array()
440 onTouchXChanged: {
430 onTouchXChanged: {
@@ -443,15 +433,13 @@ Rectangle {
443 spreadView.phase = 0;
433 spreadView.phase = 0;
444 spreadView.contentX = -spreadView.shift;
434 spreadView.contentX = -spreadView.shift;
446− if (dragging && status == DirectionalDragArea.Recognized && attachedToView) {
436+ if (dragging && status == DirectionalDragArea.Recognized) {
447 // Gesture recognized. Let's move the spreadView with the finger
437 // Gesture recognized. Let's move the spreadView with the finger
448− var finalX = Math.min(touchX + width, width);
438+ var dragX = Math.min(touchX + width, width); // Prevent dragging rightwards
449− spreadView.contentX = -finalX + spreadDragArea.width - spreadView.shift;
439+ dragX = -dragX + spreadDragArea.width - spreadView.shift;
450− }
440+ // Don't allow dragging further than the animation crossing with phase2's animation
451− if (attachedToView && spreadView.shiftedContentX >= spreadView.width * spreadView.positionMarker3) {
441+ var maxMovement = spreadView.width * spreadView.positionMarker4 - spreadView.shift;
452− // We passed positionMarker3. Detach from spreadView and snap it.
442+ spreadView.contentX = Math.min(dragX, maxMovement);
453− attachedToView = false;
456 gesturePoints.push(touchX);
444 gesturePoints.push(touchX);
@@ -462,10 +450,6 @@ Rectangle {
462 onStatusChanged: {
450 onStatusChanged: {
463 previousStatus = currentStatus;
451 previousStatus = currentStatus;
464 currentStatus = status;
452 currentStatus = status;
466− if (status == DirectionalDragArea.Recognized) {
467− attachedToView = true;
471 onDraggingChanged: {
455 onDraggingChanged: {
@@ -493,7 +477,7 @@ Rectangle {
493 // If it was a short one-way movement, do the Alt+Tab switch
477 // If it was a short one-way movement, do the Alt+Tab switch
494 // no matter if we didn't cross positionMarker1 yet.
478 // no matter if we didn't cross positionMarker1 yet.
495 spreadView.snapTo(1);
479 spreadView.snapTo(1);
496− } else if (!dragging && attachedToView) {
480+ } else if (!dragging) {
497 // otherwise snap to the closest snap position we can find
481 // otherwise snap to the closest snap position we can find
498 // (might be back to start, to app 1 or to spread)
482 // (might be back to start, to app 1 or to spread)
499 spreadView.snap();
483 spreadView.snap();