on xenial help sign in
make the side stage stuff working properly again. might need some animation tweaking still
9053614Michael Zanetti
qml/Stage/Spread/StagedRightEdgeMaths.qml+28−15
@@ -30,7 +30,7 @@ QtObject {
30// onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
30// onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
31
31
32 // Config
32 // Config
33− property real breakPoint: 0.4
33+ property real breakPoint: units.gu(15) / sceneWidth
34 property int tileDistance: units.gu(10)
34 property int tileDistance: units.gu(10)
35
35
36 // Output
36 // Output
@@ -46,40 +46,43 @@ QtObject {
46 return progress < breakPoint ? root.sceneHeight : MathUtils.linearAnimation(breakPoint, 1, root.sceneHeight, targetHeight, progress)
46 return progress < breakPoint ? root.sceneHeight : MathUtils.linearAnimation(breakPoint, 1, root.sceneHeight, targetHeight, progress)
47 }
47 }
48
48
49− readonly property var nextStage: appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
50
49
51 readonly property int animatedX: {
50 readonly property int animatedX: {
52− var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
53−
54−// var nextStage = ApplicationInfoInterface.MainStage;
51+ var nextStage = appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
55−// if (topLevelSurfaceList.count > nextInStack) {
56−// nextStage = appRepeater.itemAt(nextInStack).stage;
57−// }
58
52
59 if (model.application.appId == "unity8-dash") {
53 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)
61 }
55 }
62
56
63 var startX = 0;
57 var startX = 0;
64 if (isMainStageApp) {
58 if (isMainStageApp) {
65 if (progress < breakPoint) {
59 if (progress < breakPoint) {
60+ if (nextStage == ApplicationInfoInterface.MainStage) {
66− return MathUtils.linearAnimation(0, breakPoint, 0, -units.gu(4), progress);
61+ return MathUtils.linearAnimation(0, breakPoint, 0, -units.gu(4), progress);
62+ } else {
63+ return 0;
64+ }
67 } else {
65 } else {
66+ if (nextStage == ApplicationInfoInterface.MainStage) {
68− return MathUtils.linearAnimation(breakPoint, 1, -units.gu(4), targetX, progress);
67+ return MathUtils.linearAnimation(breakPoint, 1, -units.gu(4), targetX, progress);
68+ } else {
69+ return MathUtils.linearAnimation(breakPoint, 1, 0, targetX, progress);
70+ }
69 }
71 }
70 } else if (isSideStageApp) {
72 } else if (isSideStageApp) {
71 startX = sceneWidth - sideStageWidth;
73 startX = sceneWidth - sideStageWidth;
72 } else if (itemIndex == nextInStack && itemIndex <= 2 && priv.sideStageDelegate && nextStage == ApplicationInfoInterface.MainStage) {
74 } else if (itemIndex == nextInStack && itemIndex <= 2 && priv.sideStageDelegate && nextStage == ApplicationInfoInterface.MainStage) {
73 startX = sceneWidth - sideStageWidth;
75 startX = sceneWidth - sideStageWidth;
74 } else {
76 } else {
77+ var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
75 startX = sceneWidth + Math.max(0, itemIndex - stageCount - 1) * tileDistance;
78 startX = sceneWidth + Math.max(0, itemIndex - stageCount - 1) * tileDistance;
76 }
79 }
77
80
78 if (itemIndex == nextInStack) {
81 if (itemIndex == nextInStack) {
79 if (progress < breakPoint) {
82 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)
81 }
84 }
82− return MathUtils.linearAnimation(breakPoint, 1, sceneWidth / 2, targetX, progress)
85+ return MathUtils.linearAnimation(breakPoint, 1, startX - units.gu(15), targetX, progress)
83 }
86 }
84
87
85 if (progress < breakPoint) {
88 if (progress < breakPoint) {
@@ -92,7 +95,12 @@ QtObject {
92
95
93 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
96 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
94
97
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+ }
96
104
97 readonly property real animatedAngle: {
105 readonly property real animatedAngle: {
98 var startAngle = 0;
106 var startAngle = 0;
@@ -104,6 +112,8 @@ QtObject {
104 startAngle = root.startAngle;
112 startAngle = root.startAngle;
105 }
113 }
106
114
115+ var nextStage = appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
116+
107 if (progress < breakPoint) {
117 if (progress < breakPoint) {
108 if (stage == nextStage) {
118 if (stage == nextStage) {
109 return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
119 return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
@@ -111,7 +121,10 @@ QtObject {
111 return 0;
121 return 0;
112 }
122 }
113 }
123 }
124+ if (itemIndex == nextInStack || (stage == nextStage && (isMainStageApp || isSideStageApp))) {
114− return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
125+ return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
126+ }
127+ return MathUtils.linearAnimation(breakPoint, 1, startAngle, targetAngle, progress);
115 }
128 }
116
129
117 readonly property real animatedScale: {
130 readonly property real animatedScale: {
qml/Stage/Stage.qml+28−7
@@ -218,7 +218,21 @@ AbstractStage {
218 print("*** updated! MainStage:", priv.mainStageAppId, "SideStage:", priv.sideStageAppId)
218 print("*** updated! MainStage:", priv.mainStageAppId, "SideStage:", priv.sideStageAppId)
219 }
219 }
220
220
221− property int nextInStack: 1
221+ property int nextInStack: {
222+ var mainStageIndex = priv.mainStageDelegate ? priv.mainStageDelegate.itemIndex : -1;
223+ var sideStageIndex = priv.sideStageDelegate ? priv.sideStageDelegate.itemIndex : -1;
224+// print("calculating nextInStack:", mainStageIndex, sideStageIndex, priv.mainStageDelegate.itemIndex, priv.sideStageDelegate.itemIndex)
225+ if (sideStageIndex == -1) {
226+ return topLevelSurfaceList.count > 1 ? 1 : -1;
227+ }
228+ if (mainStageIndex == 0 || sideStageIndex == 0) {
229+ if (mainStageIndex == 1 || sideStageIndex == 1) {
230+ return 2;
231+ }
232+ return 1;
233+ }
234+ return -1;
235+ }
222
236
223 readonly property real virtualKeyboardHeight: SurfaceManager.inputMethodSurface
237 readonly property real virtualKeyboardHeight: SurfaceManager.inputMethodSurface
224 ? SurfaceManager.inputMethodSurface.inputBounds.height
238 ? SurfaceManager.inputMethodSurface.inputBounds.height
@@ -311,7 +325,7 @@ AbstractStage {
311 },
325 },
312 State {
326 State {
313 name: "sideStagedRightEdge"; when: rightEdgeDragArea.dragging && root.mode == "stagedWithSideStage"
327 name: "sideStagedRightEdge"; when: rightEdgeDragArea.dragging && root.mode == "stagedWithSideStage"
314− PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate && priv.sideStageDelegate.itemIndex < 2 ? 2 : 1 }
328+// PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate && priv.sideStageDelegate.itemIndex < 2 ? 2 : 1 }
315 },
329 },
316 State {
330 State {
317 name: "windowedRightEdge"; when: rightEdgeDragArea.dragging && root.mode == "windowed"
331 name: "windowedRightEdge"; when: rightEdgeDragArea.dragging && root.mode == "windowed"
@@ -322,7 +336,7 @@ AbstractStage {
322 State {
336 State {
323 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
337 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
324 PropertyChanges { target: triGestureArea; enabled: true }
338 PropertyChanges { target: triGestureArea; enabled: true }
325− PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate && priv.sideStageDelegate.itemIndex < 2 ? 2 : 1 }
339+// PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate && priv.sideStageDelegate.itemIndex < 2 ? 2 : 1 }
326 PropertyChanges { target: sideStage; visible: true }
340 PropertyChanges { target: sideStage; visible: true }
327 },
341 },
328 State {
342 State {
@@ -430,7 +444,6 @@ AbstractStage {
430 return 2;
444 return 2;
431 }
445 }
432
446
433−
434 onShownChanged: {
447 onShownChanged: {
435 print("sidestage shown changed:", shown)
448 print("sidestage shown changed:", shown)
436 if (!shown && priv.mainStageDelegate) {
449 if (!shown && priv.mainStageDelegate) {
@@ -499,6 +512,8 @@ AbstractStage {
499 }
512 }
500 }
513 }
501 z: normalZ
514 z: normalZ
515+ onZChanged: print("app", model.application.appId, "z changed to:", z)
516+
502
517
503 // Normally we want x/y where we request it to be. Width/height of our delegate will
518 // Normally we want x/y where we request it to be. Width/height of our delegate will
504 // match what the actual surface size is.
519 // match what the actual surface size is.
@@ -1411,7 +1426,7 @@ AbstractStage {
1411 gesturePoints = [];
1426 gesturePoints = [];
1412 } else {
1427 } else {
1413 // Ok. The user released. Did he drag far enough to go to full spread?
1428 // Ok. The user released. Did he drag far enough to go to full spread?
1414− if (gesturePoints[gesturePoints.length - 1] < -root.width * 0.4 ) {
1429+ if (gesturePoints[gesturePoints.length - 1] < -units.gu(15) ) {
1415 print("gone to spread true")
1430 print("gone to spread true")
1416 priv.goneToSpread = true;
1431 priv.goneToSpread = true;
1417 } else {
1432 } else {
@@ -1427,8 +1442,14 @@ AbstractStage {
1427 }
1442 }
1428
1443
1429 if (appRepeater.count > 1 &&
1444 if (appRepeater.count > 1 &&
1430− (oneWayFlick && rightEdgeDragArea.distance > units.gu(2) || rightEdgeDragArea.distance > root.width * .3)) {
1445+ (oneWayFlick && rightEdgeDragArea.distance > units.gu(2) || rightEdgeDragArea.distance > units.gu(15))) {
1446+ var nextStage = appRepeater.itemAt(priv.nextInStack).stage
1447+ for (var i = 0; i < appRepeater.count; i++) {
1448+ if (appRepeater.itemAt(i).stage == nextStage) {
1431− appRepeater.itemAt(0).playHidingAnimation()
1449+ appRepeater.itemAt(i).playHidingAnimation()
1450+ break;
1451+ }
1452+ }
1432 appRepeater.itemAt(priv.nextInStack).playFocusAnimation()
1453 appRepeater.itemAt(priv.nextInStack).playFocusAnimation()
1433 } else {
1454 } else {
1434 appRepeater.itemAt(0).playFocusAnimation();
1455 appRepeater.itemAt(0).playFocusAnimation();
qml/Stage/StageMaths.qml+2−2
@@ -25,7 +25,7 @@ QtObject {
25 // We don't want to really reorder them in the model because that allows us to keep track
25 // We don't want to really reorder them in the model because that allows us to keep track
26 // of the last focused order.
26 // of the last focused order.
27 readonly property int itemZ: {
27 readonly property int itemZ: {
28− // only shuffle when we've got a main and overlay
28+ // only shuffle when we've got a main and side stage
29 if (!sideStageDelegate) return itemIndex;
29 if (!sideStageDelegate) return itemIndex;
30
30
31 // don't shuffle indexes greater than "actives or next"
31 // don't shuffle indexes greater than "actives or next"
@@ -36,8 +36,8 @@ QtObject {
36 return 0;
36 return 0;
37 }
37 }
38
38
39+ print("App:", model.application.appId, "index:", itemIndex, "nextInStack:", nextInStack)
39 if (nextInStack > 0) {
40 if (nextInStack > 0) {
40− print("App:", model.application.appId, "index:", itemIndex, "nextInStack:", nextInStack)
41 var stageOfNextInStack = topLevelSurfaceList.applicationAt(nextInStack).stage;
41 var stageOfNextInStack = topLevelSurfaceList.applicationAt(nextInStack).stage;
42
42
43 if (itemIndex === nextInStack) {
43 if (itemIndex === nextInStack) {