on xenial help sign in
no highlight on touch activation in tablet mode
582ddf5Michael Zanetti
qml/Stage/Spread/StagedRightEdgeMaths.qml+25−4
@@ -24,6 +24,7 @@ QtObject {
24 property bool isMainStageApp: false
24 property bool isMainStageApp: false
25 property bool isSideStageApp: false
25 property bool isSideStageApp: false
26 property int nextInStack: 0
26 property int nextInStack: 0
27+ property int shuffledZ: 0
27
28
28
29
29// onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
30// onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
@@ -45,19 +46,30 @@ QtObject {
45 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)
46 }
47 }
47
48
49+ readonly property var nextStage: appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
50+
48 readonly property int animatedX: {
51 readonly property int animatedX: {
49 var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
52 var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
50
53
54+// var nextStage = ApplicationInfoInterface.MainStage;
51− if (appRepeater.count <= nextInStack) return 0;
55+// if (topLevelSurfaceList.count > nextInStack) {
56+// nextStage = appRepeater.itemAt(nextInStack).stage;
57+// }
52
58
53− var nextStage = appRepeater.itemAt(nextInStack).stage;
59+ if (model.application.appId == "unity8-dash") {
60+ print("calculating X for dash:", itemIndex, nextInStack)
61+ }
54
62
55 var startX = 0;
63 var startX = 0;
56 if (isMainStageApp) {
64 if (isMainStageApp) {
57− startX = 0;
65+ if (progress < breakPoint) {
66+ return MathUtils.linearAnimation(0, breakPoint, 0, -units.gu(4), progress);
67+ } else {
68+ return MathUtils.linearAnimation(breakPoint, 1, -units.gu(4), targetX, progress);
69+ }
58 } else if (isSideStageApp) {
70 } else if (isSideStageApp) {
59 startX = sceneWidth - sideStageWidth;
71 startX = sceneWidth - sideStageWidth;
60− } else if (itemIndex == nextInStack && itemIndex < 2 && priv.sideStageDelegate && nextStage == ApplicationInfoInterface.MainStage) {
72+ } else if (itemIndex == nextInStack && itemIndex <= 2 && priv.sideStageDelegate && nextStage == ApplicationInfoInterface.MainStage) {
61 startX = sceneWidth - sideStageWidth;
73 startX = sceneWidth - sideStageWidth;
62 } else {
74 } else {
63 startX = sceneWidth + Math.max(0, itemIndex - stageCount - 1) * tileDistance;
75 startX = sceneWidth + Math.max(0, itemIndex - stageCount - 1) * tileDistance;
@@ -80,6 +92,8 @@ QtObject {
80
92
81 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
93 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
82
94
95+ readonly property int animatedZ: shuffledZ
96+
83 readonly property real animatedAngle: {
97 readonly property real animatedAngle: {
84 var startAngle = 0;
98 var startAngle = 0;
85 if (isMainStageApp) {
99 if (isMainStageApp) {
@@ -90,6 +104,13 @@ QtObject {
90 startAngle = root.startAngle;
104 startAngle = root.startAngle;
91 }
105 }
92
106
107+ if (progress < breakPoint) {
108+ if (stage == nextStage) {
109+ return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
110+ } else {
111+ return 0;
112+ }
113+ }
93 return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
114 return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
94 }
115 }
95
116
qml/Stage/Stage.qml+27−5
@@ -173,6 +173,16 @@ AbstractStage {
173
173
174 function updateMainAndSideStageIndexes() {
174 function updateMainAndSideStageIndexes() {
175// print("updating stage indexes, sideStage shown:", sideStage.shown)
175// print("updating stage indexes, sideStage shown:", sideStage.shown)
176+ if (root.mode != "stagedWithSideStage") {
177+ priv.sideStageDelegate = null;
178+ priv.sideStageItemId = 0;
179+ priv.sideStageAppId = "";
180+ priv.mainStageDelegate = appRepeater.itemAt(0);
181+ priv.mainStageAppId = topLevelSurfaceList.idAt(0);
182+ priv.mainStageAppId = topLevelSurfaceList.applicationAt(0).appId;
183+ return;
184+ }
185+
176 var choseMainStage = false;
186 var choseMainStage = false;
177 var choseSideStage = false;
187 var choseSideStage = false;
178
188
@@ -321,7 +331,7 @@ AbstractStage {
321 ]
331 ]
322 transitions: [
332 transitions: [
323 Transition {
333 Transition {
324− from: "stagedRightEdge"; to: "spread"
334+ from: "stagedRightEdge,sideStagedRightEdge"; to: "spread"
325 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
335 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
326 },
336 },
327 Transition {
337 Transition {
@@ -806,6 +816,8 @@ AbstractStage {
806 sideStageDelegate: priv.sideStageDelegate
816 sideStageDelegate: priv.sideStageDelegate
807 sideStageWidth: sideStage.panelWidth
817 sideStageWidth: sideStage.panelWidth
808 sideStageX: sideStage.x
818 sideStageX: sideStage.x
819+ itemIndex: appDelegate.itemIndex
820+ nextInStack: priv.nextInStack
809 }
821 }
810
822
811 StagedRightEdgeMaths {
823 StagedRightEdgeMaths {
@@ -824,6 +836,7 @@ AbstractStage {
824 targetY: spreadMaths.targetY
836 targetY: spreadMaths.targetY
825 targetAngle: spreadMaths.targetAngle
837 targetAngle: spreadMaths.targetAngle
826 targetScale: spreadMaths.targetScale
838 targetScale: spreadMaths.targetScale
839+ shuffledZ: stageMaths.itemZ
827 }
840 }
828
841
829 WindowedRightEdgeMaths {
842 WindowedRightEdgeMaths {
@@ -832,8 +845,6 @@ AbstractStage {
832 startWidth: appDelegate.requestedWidth
845 startWidth: appDelegate.requestedWidth
833 startHeight: appDelegate.requestedHeight
846 startHeight: appDelegate.requestedHeight
834 targetHeight: spreadItem.stackHeight
847 targetHeight: spreadItem.stackHeight
835− startX: appDelegate.windowedX
836− startY: appDelegate.windowedY
837 targetX: spreadMaths.targetX
848 targetX: spreadMaths.targetX
838 targetY: spreadMaths.targetY
849 targetY: spreadMaths.targetY
839 normalZ: appDelegate.normalZ
850 normalZ: appDelegate.normalZ
@@ -884,7 +895,7 @@ AbstractStage {
884 target: appDelegate
895 target: appDelegate
885 x: stagedRightEdgeMaths.animatedX
896 x: stagedRightEdgeMaths.animatedX
886 y: stagedRightEdgeMaths.animatedY
897 y: stagedRightEdgeMaths.animatedY
887− z: index +1
898+ z: stagedRightEdgeMaths.animatedZ
888 height: stagedRightEdgeMaths.animatedHeight
899 height: stagedRightEdgeMaths.animatedHeight
889 requestedWidth: decoratedWindow.oldRequestedWidth
900 requestedWidth: decoratedWindow.oldRequestedWidth
890 requestedHeight: decoratedWindow.oldRequestedHeight
901 requestedHeight: decoratedWindow.oldRequestedHeight
@@ -1157,6 +1168,9 @@ AbstractStage {
1157 to: "windowedRightEdge"
1168 to: "windowedRightEdge"
1158 ScriptAction {
1169 ScriptAction {
1159 script: {
1170 script: {
1171+ windowedRightEdgeMaths.startX = appDelegate.requestedX
1172+ windowedRightEdgeMaths.startY = appDelegate.requestedY
1173+
1160 if (index == 1) {
1174 if (index == 1) {
1161 print("should calculate overlap from", model.application.appId, "with", appRepeater.itemAt(0).application.appId)
1175 print("should calculate overlap from", model.application.appId, "with", appRepeater.itemAt(0).application.appId)
1162 var thisRect = { x: appDelegate.windowedX, y: appDelegate.windowedY, width: appDelegate.requestedWidth, height: appDelegate.requestedHeight }
1176 var thisRect = { x: appDelegate.windowedX, y: appDelegate.windowedY, width: appDelegate.requestedWidth, height: appDelegate.requestedHeight }
@@ -1255,7 +1269,6 @@ AbstractStage {
1255
1269
1256 property real angle: 0
1270 property real angle: 0
1257 property real itemScale: 1
1271 property real itemScale: 1
1258− onAngleChanged: print("decoratedWindowd", model.application.appId, "angle", angle)
1259 transform: [
1272 transform: [
1260 Scale {
1273 Scale {
1261 origin.x: 0
1274 origin.x: 0
@@ -1269,6 +1282,15 @@ AbstractStage {
1269 angle: decoratedWindow.angle
1282 angle: decoratedWindow.angle
1270 }
1283 }
1271 ]
1284 ]
1285+
1286+ Label {
1287+ anchors.horizontalCenter: parent.horizontalCenter
1288+ anchors.bottom: parent.bottom
1289+ anchors.bottomMargin: units.gu(3)
1290+ color: "red"
1291+ fontSize: "x-large"
1292+ text: appDelegate.z
1293+ }
1272 }
1294 }
1273
1295
1274 OpacityMask {
1296 OpacityMask {
qml/Stage/StageMaths.qml+46−6
@@ -6,6 +6,7 @@ QtObject {
6
6
7 // input
7 // input
8 property int itemIndex: 0
8 property int itemIndex: 0
9+ property int nextInStack: 0
9 property int sceneWidth: 0
10 property int sceneWidth: 0
10 property int sideStageWidth: 0
11 property int sideStageWidth: 0
11 property int sideStageX: sceneWidth
12 property int sideStageX: sceneWidth
@@ -16,15 +17,54 @@ QtObject {
16 property var sideStageDelegate: null
17 property var sideStageDelegate: null
17
18
18 // output
19 // output
19− readonly property int itemZ: stage == ApplicationInfoInterface.MainStage ? 0 :
20+// readonly property int itemZ: stage == ApplicationInfoInterface.MainStage ? 0 :
20− stage == ApplicationInfoInterface.SideStage ? 2 :
21+// stage == ApplicationInfoInterface.SideStage ? 2 :
21− itemIndex + 2
22+// itemIndex + 2
23+
24+ // We need to shuffle z ordering a bit in order to keep side stage apps above main stage apps.
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.
27+ readonly property int itemZ: {
28+ // only shuffle when we've got a main and overlay
29+ if (!sideStageDelegate) return itemIndex;
30+
31+ // don't shuffle indexes greater than "actives or next"
32+ if (itemIndex > 2) return itemIndex;
33+
34+ if (thisDelegate == mainStageDelegate) {
35+ // Active main stage always at 0
36+ return 0;
37+ }
38+
39+ if (nextInStack > 0) {
40+ print("App:", model.application.appId, "index:", itemIndex, "nextInStack:", nextInStack)
41+ var stageOfNextInStack = topLevelSurfaceList.applicationAt(nextInStack).stage;
42+
43+ if (itemIndex === nextInStack) {
44+ // this is the next app in stack.
45+
46+ if (stage === ApplicationInfoInterface.SideStage) {
47+ // if the next app in stack is a sidestage app, it must order on top of other side stage app
48+ return Math.min(2, topLevelSurfaceList.count-1);
49+ }
50+ return 1;
51+ }
52+ if (stageOfNextInStack === ApplicationInfoInterface.SideStage) {
53+ // if the next app in stack is a sidestage app, it must order on top of other side stage app
54+ return 1;
55+ }
56+ print("returning", Math.min(2, topLevelSurfaceList.count-1), topLevelSurfaceList.count)
57+ return Math.min(2, topLevelSurfaceList.count-1);
58+ }
59+ return Math.min(index+1, topLevelSurfaceList.count-1);
60+ }
61+
22
62
23 readonly property int itemX: mainStageDelegate == thisDelegate ? 0 :
63 readonly property int itemX: mainStageDelegate == thisDelegate ? 0 :
24− sideStageDelegate == thisDelegate ? sideStageX :
64+ sideStageDelegate == thisDelegate ? sideStageX :
25− sceneWidth
65+ sceneWidth
26
66
27 readonly property int itemWidth: stage == ApplicationInfoInterface.MainStage ?
67 readonly property int itemWidth: stage == ApplicationInfoInterface.MainStage ?
28 sideStageDelegate != null ? sideStageX : sceneWidth :
68 sideStageDelegate != null ? sideStageX : sceneWidth :
29− stage == ApplicationInfoInterface.SideStage ? sideStageWidth : sceneWidth
69+ stage == ApplicationInfoInterface.SideStage ? sideStageWidth : sceneWidth
30}
70}