on xenial help sign in
more work on the right edge gesture
4f02382Michael Zanetti
qml/Stages/DesktopStage.qml+14−51
@@ -302,6 +302,7 @@ AbstractStage {
302 },
302 },
303 State {
303 State {
304 name: "sidestagedrightedge"; when: rightEdgeDragArea.dragging && root.mode == "stagedWithSideStage"
304 name: "sidestagedrightedge"; when: rightEdgeDragArea.dragging && root.mode == "stagedWithSideStage"
305+ PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate && priv.sideStageDelegate.itemIndex < 2 ? 2 : 1 }
305 },
306 },
306 State {
307 State {
307 name: "windowedrightedge"; when: rightEdgeDragArea.dragging && root.mode == "windowed"
308 name: "windowedrightedge"; when: rightEdgeDragArea.dragging && root.mode == "windowed"
@@ -312,7 +313,7 @@ AbstractStage {
312 State {
313 State {
313 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
314 name: "stagedWithSideStage"; when: root.mode === "stagedWithSideStage"
314 PropertyChanges { target: triGestureArea; enabled: true }
315 PropertyChanges { target: triGestureArea; enabled: true }
315− PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate ? 3 : 2 }
316+ PropertyChanges { target: priv; nextInStack: priv.sideStageDelegate && priv.sideStageDelegate.itemIndex < 2 ? 2 : 1 }
316 PropertyChanges { target: sideStage; visible: true }
317 PropertyChanges { target: sideStage; visible: true }
317 },
318 },
318 State {
319 State {
@@ -473,6 +474,7 @@ AbstractStage {
473 delegate: FocusScope {
474 delegate: FocusScope {
474 id: appDelegate
475 id: appDelegate
475 objectName: "appDelegate_" + model.id
476 objectName: "appDelegate_" + model.id
477+ property int itemIndex: index // We need this from outside the repeater
476 // z might be overriden in some cases by effects, but we need z ordering
478 // z might be overriden in some cases by effects, but we need z ordering
477 // to calculate occlusion detection
479 // to calculate occlusion detection
478 property int normalZ: topLevelSurfaceList.count - index
480 property int normalZ: topLevelSurfaceList.count - index
@@ -789,26 +791,13 @@ AbstractStage {
789
791
790 StagedRightEdgeMaths {
792 StagedRightEdgeMaths {
791 id: stagedRightEdgeMaths
793 id: stagedRightEdgeMaths
792− itemIndex: index
793− sceneWidth: appContainer.width - root.leftMargin
794− sceneHeight: appContainer.height
795− progress: 0
796− targetHeight: spreadMaths.stackHeight
797− targetX: spreadMaths.targetX
798− startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
799− targetY: spreadMaths.targetY
800− targetAngle: spreadMaths.targetAngle
801− targetScale: spreadMaths.targetScale
802− }
803−
804− SideStagedRightEdgeMaths {
805− id: sideStagedRightEdgeMaths
806 sceneWidth: appContainer.width - root.leftMargin
794 sceneWidth: appContainer.width - root.leftMargin
807 sceneHeight: appContainer.height
795 sceneHeight: appContainer.height
808 isMainStageApp: priv.mainStageDelegate == appDelegate
796 isMainStageApp: priv.mainStageDelegate == appDelegate
809 isSideStageApp: priv.sideStageDelegate == appDelegate
797 isSideStageApp: priv.sideStageDelegate == appDelegate
810 sideStageWidth: sideStage.width
798 sideStageWidth: sideStage.width
811 itemIndex: index
799 itemIndex: index
800+ nextInStack: priv.nextInStack
812 progress: 0
801 progress: 0
813 targetHeight: spreadMaths.stackHeight
802 targetHeight: spreadMaths.stackHeight
814 targetX: spreadMaths.targetX
803 targetX: spreadMaths.targetX
@@ -849,56 +838,29 @@ AbstractStage {
849 PropertyChanges { target: dragArea; enabled: true }
838 PropertyChanges { target: dragArea; enabled: true }
850 PropertyChanges { target: windowInfoItem; opacity: spreadMaths.tileInfoOpacity; visible: spreadMaths.itemVisible }
839 PropertyChanges { target: windowInfoItem; opacity: spreadMaths.tileInfoOpacity; visible: spreadMaths.itemVisible }
851 },
840 },
852−// State {
853−// name: "stagedrightedge";
854−// when: root.state == "stagedrightedge" || rightEdgeFocusAnimation.running || hidingAnimation.running
855−// PropertyChanges {
856−// target: stagedRightEdgeMaths
857−// progress: rightEdgeDragArea.progress
858−// }
859−// PropertyChanges {
860−// target: appDelegate
861−// y: stagedRightEdgeMaths.animatedY
862−// x: stagedRightEdgeMaths.animatedX
863−// z: index +1
864−// height: stagedRightEdgeMaths.animatedHeight
865−// requestedWidth: decoratedWindow.oldRequestedWidth
866−// requestedHeight: decoratedWindow.oldRequestedHeight
867−// visible: stagedRightEdgeMaths.itemVisible
868−// }
869−// PropertyChanges {
870−// target: decoratedWindow;
871−// hasDecoration: false
872−// angle: stagedRightEdgeMaths.animatedAngle
873−// itemScale: stagedRightEdgeMaths.animatedScale
874−// scaleToPreviewSize: spreadItem.stackHeight
875−// scaleToPreviewProgress: stagedRightEdgeMaths.scaleToPreviewProgress
876−// shadowOpacity: 0.3
877−// }
878−// },
879 State {
841 State {
880− name: "sidestagedrightedge"
842+ name: "stagedrightedge"
881 when: root.state == "sidestagedrightedge" || root.state == "stagedrightedge" || rightEdgeFocusAnimation.running || hidingAnimation.running
843 when: root.state == "sidestagedrightedge" || root.state == "stagedrightedge" || rightEdgeFocusAnimation.running || hidingAnimation.running
882 PropertyChanges {
844 PropertyChanges {
883− target: sideStagedRightEdgeMaths
845+ target: stagedRightEdgeMaths
884 progress: rightEdgeDragArea.progress
846 progress: rightEdgeDragArea.progress
885 }
847 }
886 PropertyChanges {
848 PropertyChanges {
887 target: appDelegate
849 target: appDelegate
888− x: sideStagedRightEdgeMaths.animatedX
850+ x: stagedRightEdgeMaths.animatedX
889− y: sideStagedRightEdgeMaths.animatedY
851+ y: stagedRightEdgeMaths.animatedY
890 z: index +1
852 z: index +1
891− height: sideStagedRightEdgeMaths.animatedHeight
853+ height: stagedRightEdgeMaths.animatedHeight
892 requestedWidth: decoratedWindow.oldRequestedWidth
854 requestedWidth: decoratedWindow.oldRequestedWidth
893 requestedHeight: decoratedWindow.oldRequestedHeight
855 requestedHeight: decoratedWindow.oldRequestedHeight
894 }
856 }
895 PropertyChanges {
857 PropertyChanges {
896 target: decoratedWindow
858 target: decoratedWindow
897 hasDecoration: false
859 hasDecoration: false
898− angle: sideStagedRightEdgeMaths.animatedAngle
860+ angle: stagedRightEdgeMaths.animatedAngle
899− itemScale: sideStagedRightEdgeMaths.animatedScale
861+ itemScale: stagedRightEdgeMaths.animatedScale
900 scaleToPreviewSize: spreadItem.stackHeight
862 scaleToPreviewSize: spreadItem.stackHeight
901− scaleToPreviewProgress: sideStagedRightEdgeMaths.scaleToPreviewProgress
863+ scaleToPreviewProgress: stagedRightEdgeMaths.scaleToPreviewProgress
902 shadowOpacity: .3
864 shadowOpacity: .3
903 }
865 }
904 },
866 },
@@ -1345,8 +1307,9 @@ AbstractStage {
1345 priv.goneToSpread = true;
1307 priv.goneToSpread = true;
1346 } else {
1308 } else {
1347 if (appRepeater.count > 1) {
1309 if (appRepeater.count > 1) {
1310+ print("playing focus animation for", priv.nextInStack)
1348 appRepeater.itemAt(0).playHidingAnimation()
1311 appRepeater.itemAt(0).playHidingAnimation()
1349− appRepeater.itemAt(1).playFocusAnimation()
1312+ appRepeater.itemAt(priv.nextInStack).playFocusAnimation()
1350 } else {
1313 } else {
1351 appRepeater.itemAt(0).playFocusAnimation();
1314 appRepeater.itemAt(0).playFocusAnimation();
1352 }
1315 }
qml/Stages/Spread/StagedRightEdgeMaths.qml+63−16
@@ -1,5 +1,6 @@
1import QtQuick 2.4
1import QtQuick 2.4
2import Ubuntu.Components 1.3
2import Ubuntu.Components 1.3
3+import Unity.Application 0.1
3import "MathUtils.js" as MathUtils
4import "MathUtils.js" as MathUtils
4
5
5QtObject {
6QtObject {
@@ -9,6 +10,7 @@ QtObject {
9 property int itemIndex: 0
10 property int itemIndex: 0
10 property real progress: 0
11 property real progress: 0
11 property int sceneWidth: 0
12 property int sceneWidth: 0
13+ property int sideStageWidth: 0
12 property int sceneHeight: 0
14 property int sceneHeight: 0
13 property int targetX: 0
15 property int targetX: 0
14 property int startY: 0
16 property int startY: 0
@@ -19,14 +21,17 @@ QtObject {
19 property real startScale: 1.3
21 property real startScale: 1.3
20 property real targetScale: 0
22 property real targetScale: 0
21
23
24+ property bool isMainStageApp: false
25+ property bool isSideStageApp: false
26+ property int nextInStack: 0
27+
28+
22− onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
29+// onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
23
30
24 // Config
31 // Config
25 property real breakPoint: 0.4
32 property real breakPoint: 0.4
26 property int tileDistance: units.gu(10)
33 property int tileDistance: units.gu(10)
27
34
28−
29−
30 // Output
35 // Output
31
36
32 readonly property real scaleToPreviewProgress: {
37 readonly property real scaleToPreviewProgress: {
@@ -42,29 +47,71 @@ QtObject {
42 }
47 }
43
48
44 readonly property int animatedX: {
49 readonly property int animatedX: {
45− if (itemIndex == 0) {
50+ var stageCount = (priv.mainStageDelegate ? 1 : 0) + (priv.sideStageDelegate ? 1 : 0)
46− return root.targetX * root.progress
51+ var nextStage = appRepeater.itemAt(nextInStack).stage;
52+
53+ var startX = 0;
54+ if (isMainStageApp) {
55+ startX = 0;
56+ } else if (isSideStageApp) {
57+ startX = sceneWidth - sideStageWidth;
58+ } else if (itemIndex == nextInStack && itemIndex < 2 && priv.sideStageDelegate && nextStage == ApplicationInfoInterface.MainStage) {
59+ startX = sceneWidth - sideStageWidth;
60+ } else {
61+ startX = sceneWidth + Math.max(0, itemIndex - stageCount - 1) * tileDistance;
47 }
62 }
48− var startX = sceneWidth //+ (itemIndex - 1) * tileDistance
63+
49− if (itemIndex == 1) {
64+ if (itemIndex == nextInStack) {
50− if (root.progress < breakPoint) {
65+ if (progress < breakPoint) {
51− return MathUtils.linearAnimation(0, breakPoint, startX, startX / 2 + (itemIndex - 1) * tileDistance, progress)
66+ return MathUtils.linearAnimation(0, breakPoint, startX, sceneWidth / 2, progress)
52 }
67 }
53− return MathUtils.linearAnimation(breakPoint, 1, startX / 2 + (itemIndex - 1) * tileDistance, targetX, progress)
68+ return MathUtils.linearAnimation(breakPoint, 1, sceneWidth / 2, targetX, progress)
54 }
69 }
70+
55 if (progress < breakPoint) {
71 if (progress < breakPoint) {
56− return startX
72+ return startX;
57 }
73 }
74+
58− return MathUtils.linearAnimation(breakPoint, 1, startX + (itemIndex - 1) * tileDistance, targetX, progress)
75+ return MathUtils.linearAnimation(breakPoint, 1, startX, targetX, progress)
76+
59 }
77 }
60
78
61 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
79 readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
62
80
63− readonly property real animatedAngle: itemIndex == 0 ? MathUtils.linearAnimation(0, 1, 0, targetAngle, progress)
81+ readonly property real animatedAngle: {
64− : Math.max(MathUtils.linearAnimation(0, breakPoint, startAngle, targetAngle, progress), targetAngle)
82+ var startAngle = 0;
83+ if (isMainStageApp) {
84+ startAngle = 0;
85+ } else if (isSideStageApp) {
86+ startAngle = 0;
87+ } else {
88+ startAngle = root.startAngle;
89+ }
65
90
91+ return MathUtils.linearAnimation(0, 1, startAngle, targetAngle, progress);
92+ }
93+
94+ readonly property real animatedScale: {
95+ var startScale = 1;
96+ if (isMainStageApp) {
97+ startScale = 1;
98+ } else if (isSideStageApp) {
99+ startScale = 1;
100+ } else {
101+ startScale = root.startScale;
102+ }
103+
104+// print("main stage delegate:", priv.mainStageDelegate, "side delegate", priv.sideStageDelegate, "this", appDelegate, "scale:", startScale)
105+// return startScale;
106+ if (itemIndex == nextInStack) {
66− readonly property real animatedScale: itemIndex == 0 ? MathUtils.linearAnimation(0, 1, 1, targetScale, progress)
107+ return MathUtils.linearAnimation(0, 1, startScale, targetScale, progress)
108+ }
109+ if (progress < breakPoint) {
110+ return startScale;
111+ }
112+
67− : MathUtils.linearAnimation(0, 1, startScale, targetScale, progress)
113+ return MathUtils.linearAnimation(breakPoint, 1, startScale, targetScale, progress)
114+ }
68
115
69 readonly property bool itemVisible: true //animatedX < sceneWidth
116 readonly property bool itemVisible: true //animatedX < sceneWidth
70}
117}