on xenial help sign in
no highlight on touch activation in tablet mode
commit582ddf5979a669e50f3aac8552299513edefaea3 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 29 Aug 2016, 11:04 (10 years ago) parent666ce13
3 files changed+98−15
qml/Stage/Spread/StagedRightEdgeMaths.qml+25−4 qml/Stage/Stage.qml+27−5 qml/Stage/StageMaths.qml+46−6
qml/Stage/Spread/StagedRightEdgeMaths.qml+25−4
@@ -24,6 +24,7 @@ QtObject {
2424 property bool isMainStageApp: false
2525 property bool isSideStageApp: false
2626 property int nextInStack: 0
27+ property int shuffledZ: 0
2728
2829
2930// onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
@@ -45,19 +46,30 @@ QtObject {
4546 return progress < breakPoint ? root.sceneHeight : MathUtils.linearAnimation(breakPoint, 1, root.sceneHeight, targetHeight, progress)
4647 }
4748
49+ readonly property var nextStage: appRepeater.itemAt(nextInStack) ? appRepeater.itemAt(nextInStack).stage : ApplicationInfoInterface.MainStage;
50+
4851 readonly property int animatedX: {
4952 var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
5053
51− if (appRepeater.count <= nextInStack) return 0;
54+// var nextStage = ApplicationInfoInterface.MainStage;
55+// if (topLevelSurfaceList.count > nextInStack) {
56+// nextStage = appRepeater.itemAt(nextInStack).stage;
57+// }
5258
53− var nextStage = appRepeater.itemAt(nextInStack).stage;
59+ if (model.application.appId == "unity8-dash") {
60+ print("calculating X for dash:", itemIndex, nextInStack)
61+ }
5462
5563 var startX = 0;
5664 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+ }
5870 } else if (isSideStageApp) {
5971 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) {
6173 startX = sceneWidth - sideStageWidth;
6274 } else {
6375 startX = sceneWidth + Math.max(0, itemIndex - stageCount - 1) * tileDistance;
@@ -80,6 +92,8 @@ QtObject {
8092
8193 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
8294
95+ readonly property int animatedZ: shuffledZ
96+
8397 readonly property real animatedAngle: {
8498 var startAngle = 0;
8599 if (isMainStageApp) {
@@ -90,6 +104,13 @@ QtObject {
90104 startAngle = root.startAngle;
91105 }
92106
107+ if (progress < breakPoint) {
108+ if (stage == nextStage) {
109+ return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
110+ } else {
111+ return 0;
112+ }
113+ }
93114 return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
94115 }
95116
qml/Stage/Stage.qml+27−5
@@ -173,6 +173,16 @@ AbstractStage {
173173
174174 function updateMainAndSideStageIndexes() {
175175// 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+
176186 var choseMainStage = false;
177187 var choseSideStage = false;
178188
@@ -321,7 +331,7 @@ AbstractStage {
321331 ]
322332 transitions: [
323333 Transition {
324− from: "stagedRightEdge"; to: "spread"
334+ from: "stagedRightEdge,sideStagedRightEdge"; to: "spread"
325335 PropertyAction { target: spreadItem; property: "highlightedIndex"; value: -1 }
326336 },
327337 Transition {
@@ -806,6 +816,8 @@ AbstractStage {
806816 sideStageDelegate: priv.sideStageDelegate
807817 sideStageWidth: sideStage.panelWidth
808818 sideStageX: sideStage.x
819+ itemIndex: appDelegate.itemIndex
820+ nextInStack: priv.nextInStack
809821 }
810822
811823 StagedRightEdgeMaths {
@@ -824,6 +836,7 @@ AbstractStage {
824836 targetY: spreadMaths.targetY
825837 targetAngle: spreadMaths.targetAngle
826838 targetScale: spreadMaths.targetScale
839+ shuffledZ: stageMaths.itemZ
827840 }
828841
829842 WindowedRightEdgeMaths {
@@ -832,8 +845,6 @@ AbstractStage {
832845 startWidth: appDelegate.requestedWidth
833846 startHeight: appDelegate.requestedHeight
834847 targetHeight: spreadItem.stackHeight
835− startX: appDelegate.windowedX
836− startY: appDelegate.windowedY
837848 targetX: spreadMaths.targetX
838849 targetY: spreadMaths.targetY
839850 normalZ: appDelegate.normalZ
@@ -884,7 +895,7 @@ AbstractStage {
884895 target: appDelegate
885896 x: stagedRightEdgeMaths.animatedX
886897 y: stagedRightEdgeMaths.animatedY
887− z: index +1
898+ z: stagedRightEdgeMaths.animatedZ
888899 height: stagedRightEdgeMaths.animatedHeight
889900 requestedWidth: decoratedWindow.oldRequestedWidth
890901 requestedHeight: decoratedWindow.oldRequestedHeight
@@ -1157,6 +1168,9 @@ AbstractStage {
11571168 to: "windowedRightEdge"
11581169 ScriptAction {
11591170 script: {
1171+ windowedRightEdgeMaths.startX = appDelegate.requestedX
1172+ windowedRightEdgeMaths.startY = appDelegate.requestedY
1173+
11601174 if (index == 1) {
11611175 print("should calculate overlap from", model.application.appId, "with", appRepeater.itemAt(0).application.appId)
11621176 var thisRect = { x: appDelegate.windowedX, y: appDelegate.windowedY, width: appDelegate.requestedWidth, height: appDelegate.requestedHeight }
@@ -1255,7 +1269,6 @@ AbstractStage {
12551269
12561270 property real angle: 0
12571271 property real itemScale: 1
1258− onAngleChanged: print("decoratedWindowd", model.application.appId, "angle", angle)
12591272 transform: [
12601273 Scale {
12611274 origin.x: 0
@@ -1269,6 +1282,15 @@ AbstractStage {
12691282 angle: decoratedWindow.angle
12701283 }
12711284 ]
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+ }
12721294 }
12731295
12741296 OpacityMask {
qml/Stage/StageMaths.qml+46−6
@@ -6,6 +6,7 @@ QtObject {
66
77 // input
88 property int itemIndex: 0
9+ property int nextInStack: 0
910 property int sceneWidth: 0
1011 property int sideStageWidth: 0
1112 property int sideStageX: sceneWidth
@@ -16,15 +17,54 @@ QtObject {
1617 property var sideStageDelegate: null
1718
1819 // output
19− readonly property int itemZ: stage == ApplicationInfoInterface.MainStage ? 0 :
20− stage == ApplicationInfoInterface.SideStage ? 2 :
21− itemIndex + 2
20+// readonly property int itemZ: stage == ApplicationInfoInterface.MainStage ? 0 :
21+// stage == ApplicationInfoInterface.SideStage ? 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+
2262
2363 readonly property int itemX: mainStageDelegate == thisDelegate ? 0 :
24− sideStageDelegate == thisDelegate ? sideStageX :
25− sceneWidth
64+ sideStageDelegate == thisDelegate ? sideStageX :
65+ sceneWidth
2666
2767 readonly property int itemWidth: stage == ApplicationInfoInterface.MainStage ?
2868 sideStageDelegate != null ? sideStageX : sceneWidth :
29− stage == ApplicationInfoInterface.SideStage ? sideStageWidth : sceneWidth
69+ stage == ApplicationInfoInterface.SideStage ? sideStageWidth : sceneWidth
3070}