@@ -857,6 +857,7 @@ AbstractStage {
857 targetAngle: spreadMaths.targetAngle
857 targetAngle: spreadMaths.targetAngle
858 targetScale: spreadMaths.targetScale
858 targetScale: spreadMaths.targetScale
859 shuffledZ: stageMaths.itemZ
859 shuffledZ: stageMaths.itemZ
860+ breakPoint: spreadItem.rightEdgeBreakPoint
862 WindowedRightEdgeMaths {
863 WindowedRightEdgeMaths {
@@ -870,6 +871,7 @@ AbstractStage {
870 normalZ: appDelegate.normalZ
871 normalZ: appDelegate.normalZ
871 targetAngle: spreadMaths.targetAngle
872 targetAngle: spreadMaths.targetAngle
872 targetScale: spreadMaths.targetScale
873 targetScale: spreadMaths.targetScale
874+ breakPoint: spreadItem.rightEdgeBreakPoint
875 states: [
877 states: [
@@ -1206,6 +1208,17 @@ AbstractStage {
1213+ from: "stagedRightEdge"; to: "staged"
1214+ SequentialAnimation {
1215+ ParallelAnimation {
1216+ UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height,width,scale"; duration: priv.animationDuration }
1217+ UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,itemScale,angle,scaleToPreviewProgress"; duration: priv.animationDuration }
1219+ // // We need to release scaleToPreviewSize at last
1220+ PropertyAction { target: decoratedWindow; property: "scaleToPreviewSize" }
@@ -1412,6 +1425,9 @@ AbstractStage {
1413 onTouchPositionChanged: {
1426 onTouchPositionChanged: {
1414 gesturePoints.push(touchPosition.x);
1427 gesturePoints.push(touchPosition.x);
1428+ if (gesturePoints.length > 10) {
1429+ gesturePoints.splice(0, gesturePoints.length - 10)
1417 onDraggingChanged: {
1433 onDraggingChanged: {
@@ -1421,11 +1437,29 @@ AbstractStage {
1421 gesturePoints = [];
1437 gesturePoints = [];
1422 } else {
1438 } else {
1423 // Ok. The user released. Did he drag far enough to go to full spread?
1439 // Ok. The user released. Did he drag far enough to go to full spread?
1424− if (gesturePoints[gesturePoints.length - 1] < -units.gu(15) ) {
1440+ if (gesturePoints[gesturePoints.length - 1] < -spreadItem.rightEdgeBreakPoint * spreadItem.width ) {
1425− print("gone to spread true")
1441+
1442+ // He dragged far enough, but if the last movement was a flick to the right again, he wants to cancel the spread again.
1443+ var oneWayFlickToRight = true;
1444+ var smallestX = gesturePoints[0]-1;
1445+ for (var i = 0; i < gesturePoints.length; i++) {
1446+ print("have point:", gesturePoints[i])
1447+ if (gesturePoints[i] <= smallestX) {
1448+ oneWayFlickToRight = false;
1451+ smallestX = gesturePoints[i];
1454+ if (!oneWayFlickToRight) {
1455+ // Ok, the user made it, let's go to spread!
1426− priv.goneToSpread = true;
1456+ priv.goneToSpread = true;
1458+// appRepeater.itemAt(0).playFocusAnimation();
1427 } else {
1460 } else {
1461+ // Ok, the user didn't drag far enough to cross the breakPoint
1428− // Find out if it was a one-way movement.
1462+ // Find out if it was a one-way movement to the left, in which case we just switch directly to next app.
1429 var oneWayFlick = true;
1463 var oneWayFlick = true;
1430 var smallestX = rightEdgeDragArea.width;
1464 var smallestX = rightEdgeDragArea.width;
1431 for (var i = 0; i < gesturePoints.length; i++) {
1465 for (var i = 0; i < gesturePoints.length; i++) {
@@ -1437,7 +1471,7 @@ AbstractStage {
1439 if (appRepeater.count > 1 &&
1473 if (appRepeater.count > 1 &&
1440− (oneWayFlick && rightEdgeDragArea.distance > units.gu(2) || rightEdgeDragArea.distance > units.gu(15))) {
1474+ (oneWayFlick && rightEdgeDragArea.distance > units.gu(2) || rightEdgeDragArea.distance > spreadItem.rightEdgeBreakPoint * spreadItem.width)) {
1441 var nextStage = appRepeater.itemAt(priv.nextInStack).stage
1475 var nextStage = appRepeater.itemAt(priv.nextInStack).stage
1442 for (var i = 0; i < appRepeater.count; i++) {
1476 for (var i = 0; i < appRepeater.count; i++) {
1443 if (appRepeater.itemAt(i).stage == nextStage) {
1477 if (appRepeater.itemAt(i).stage == nextStage) {