@@ -30,7 +30,7 @@ QtObject {
3030// onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
3131
3232 // Config
33− property real breakPoint: 0.4
33+ property real breakPoint: units.gu(15) / sceneWidth
3434 property int tileDistance: units.gu(10)
3535
3636 // Output
@@ -46,40 +46,43 @@ QtObject {
4646 return progress < breakPoint ? root.sceneHeight : MathUtils.linearAnimation(breakPoint, 1, root.sceneHeight, targetHeight, progress)
4747 }
4848
49− readonly property var nextStage: appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
5049
5150 readonly property int animatedX: {
52− var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
53−
54−// var nextStage = ApplicationInfoInterface.MainStage;
55−// if (topLevelSurfaceList.count > nextInStack) {
56−// nextStage = appRepeater.itemAt(nextInStack).stage;
57−// }
51+ var nextStage = appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
5852
5953 if (model.application.appId == "unity8-dash") {
60− print("calculating X for dash:", itemIndex, nextInStack)
54+ print("calculating X for dash:", itemIndex, nextInStack, nextStage, "(Main:", ApplicationInfoInterface.MainStage,")", appRepeater.itemAt(nextInStack).stage)
6155 }
6256
6357 var startX = 0;
6458 if (isMainStageApp) {
6559 if (progress < breakPoint) {
66− return MathUtils.linearAnimation(0, breakPoint, 0, -units.gu(4), progress);
60+ if (nextStage == ApplicationInfoInterface.MainStage) {
61+ return MathUtils.linearAnimation(0, breakPoint, 0, -units.gu(4), progress);
62+ } else {
63+ return 0;
64+ }
6765 } else {
68− return MathUtils.linearAnimation(breakPoint, 1, -units.gu(4), targetX, progress);
66+ if (nextStage == ApplicationInfoInterface.MainStage) {
67+ return MathUtils.linearAnimation(breakPoint, 1, -units.gu(4), targetX, progress);
68+ } else {
69+ return MathUtils.linearAnimation(breakPoint, 1, 0, targetX, progress);
70+ }
6971 }
7072 } else if (isSideStageApp) {
7173 startX = sceneWidth - sideStageWidth;
7274 } else if (itemIndex == nextInStack && itemIndex <= 2 && priv.sideStageDelegate && nextStage == ApplicationInfoInterface.MainStage) {
7375 startX = sceneWidth - sideStageWidth;
7476 } else {
77+ var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
7578 startX = sceneWidth + Math.max(0, itemIndex - stageCount - 1) * tileDistance;
7679 }
7780
7881 if (itemIndex == nextInStack) {
7982 if (progress < breakPoint) {
80− return MathUtils.linearAnimation(0, breakPoint, startX, sceneWidth / 2, progress)
83+ return MathUtils.linearAnimation(0, breakPoint, startX, startX - units.gu(15), progress)
8184 }
82− return MathUtils.linearAnimation(breakPoint, 1, sceneWidth / 2, targetX, progress)
85+ return MathUtils.linearAnimation(breakPoint, 1, startX - units.gu(15), targetX, progress)
8386 }
8487
8588 if (progress < breakPoint) {
@@ -92,7 +95,12 @@ QtObject {
9295
9396 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
9497
95− readonly property int animatedZ: shuffledZ
98+ readonly property int animatedZ: {
99+ if (progress < breakPoint + (1 - breakPoint) / 2) {
100+ return shuffledZ
101+ }
102+ return itemIndex;
103+ }
96104
97105 readonly property real animatedAngle: {
98106 var startAngle = 0;
@@ -104,6 +112,8 @@ QtObject {
104112 startAngle = root.startAngle;
105113 }
106114
115+ var nextStage = appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
116+
107117 if (progress < breakPoint) {
108118 if (stage == nextStage) {
109119 return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
@@ -111,7 +121,10 @@ QtObject {
111121 return 0;
112122 }
113123 }
114− return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
124+ if (itemIndex == nextInStack || (stage == nextStage && (isMainStageApp || isSideStageApp))) {
125+ return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
126+ }
127+ return MathUtils.linearAnimation(breakPoint, 1, startAngle, targetAngle, progress);
115128 }
116129
117130 readonly property real animatedScale: {