on xenial help sign in
short right edge gesture for staged mode
commitabdb078f544c9af5c38ea48a45c1000875701a02 authorMichael Zanetti <michael.zanetti@canonical.com> dateSat 16 Jul 2016, 01:48 (10 years ago) parentfeac422
5 files changed+79−36
po/unity8.pot+1−1 qml/Stages/DecoratedWindow.qml+13−3 qml/Stages/DesktopStage.qml+29−19 qml/Stages/Spread/SpreadMaths.qml+1−1 qml/Stages/Spread/StagedRightEdgeMaths.qml+35−12
po/unity8.pot+1−1
@@ -8,7 +8,7 @@ msgid ""
88msgstr ""
99"Project-Id-Version: unity8\n"
1010"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2016-07-14 17:51+0200\n"
11+"POT-Creation-Date: 2016-07-16 01:28+0200\n"
1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414"Language-Team: LANGUAGE <LL@li.org>\n"
qml/Stages/DecoratedWindow.qml+13−3
@@ -35,8 +35,9 @@ FocusScope {
3535 property bool hasDecoration: true
3636 // This will temporarily show/hide the decoration without actually changing the surface's dimensions
3737 property bool showDecoration: true
38+ property bool animateDecoration: false
3839 property bool showHighlight: false
39− property real shadowOpacity: 1
40+ property real shadowOpacity: 0
4041
4142 property real requestedWidth
4243 property real requestedHeight
@@ -67,10 +68,10 @@ FocusScope {
6768 QtObject {
6869 id: d
6970 property int requestedDecorationHeight: root.hasDecoration && root.hasDecoration ? decoration.height : 0
70− Behavior on requestedDecorationHeight { UbuntuNumberAnimation { duration: priv.animationDuration } }
71+ Behavior on requestedDecorationHeight { enabled: root.animateDecoration; UbuntuNumberAnimation { duration: priv.animationDuration } }
7172
7273 property int visibleDecorationHeight: root.showDecoration && root.hasDecoration ? decoration.height : 0
73− Behavior on visibleDecorationHeight { UbuntuNumberAnimation { duration: priv.animationDuration } }
74+ Behavior on visibleDecorationHeight { enabled: root.animateDecoration; UbuntuNumberAnimation { duration: priv.animationDuration } }
7475 }
7576
7677 Rectangle {
@@ -88,6 +89,15 @@ FocusScope {
8889 visible: showHighlight
8990 }
9091
92+ BorderImage {
93+ anchors {
94+ fill: decoratedWindow
95+ margins: active ? -units.gu(2) : -units.gu(1.5)
96+ }
97+ source: "graphics/dropshadow2gu.sci"
98+ opacity: root.shadowOpacity
99+ }
100+
91101 WindowDecoration {
92102 id: decoration
93103 target: root.parent
qml/Stages/DesktopStage.qml+29−19
@@ -129,7 +129,8 @@ AbstractStage {
129129 property var foregroundMaximizedAppDelegate: null // for stuff like drop shadow and focusing maximized app by clicking panel
130130
131131 property bool goneToSpread: false
132− property int animationDuration: UbuntuAnimation.FastDuration //4000//UbuntuAnimation.SleepyDuration
132+// property int animationDuration: 4000
133+ property int animationDuration: UbuntuAnimation.FastDuration
133134
134135 function updateForegroundMaximizedApp() {
135136 var found = false;
@@ -490,7 +491,7 @@ AbstractStage {
490491 readonly property bool maximizedHorizontally: windowState & WindowStateStorage.WindowStateMaximizedHorizontally
491492 readonly property bool maximizedVertically: windowState & WindowStateStorage.WindowStateMaximizedVertically
492493 readonly property bool minimized: windowState & WindowStateStorage.WindowStateMinimized
493− readonly property bool fullscreen: state == "fullscreen"
494+ readonly property bool fullscreen: surface.state === Mir.FullscreenState;
494495
495496 property int windowState: WindowStateStorage.WindowStateNormal
496497 property bool animationsEnabled: true
@@ -687,6 +688,7 @@ AbstractStage {
687688 id: rightEdgeFocusAnimation
688689 UbuntuNumberAnimation { target: appDelegate; properties: "x"; to: 0; duration: priv.animationDuration }
689690 UbuntuNumberAnimation { target: decoratedWindow; properties: "angle"; to: 0; duration: priv.animationDuration }
691+ UbuntuNumberAnimation { target: decoratedWindow; properties: "itemScale"; to: 1; duration: priv.animationDuration }
690692 onStopped: appDelegate.focus = true
691693 }
692694 ParallelAnimation {
@@ -720,7 +722,9 @@ AbstractStage {
720722 progress: 0
721723 targetHeight: spreadMaths.stackHeight
722724 targetX: spreadMaths.targetX
725+ targetY: spreadMaths.targetY
723726 targetAngle: spreadMaths.targetAngle
727+ targetScale: spreadMaths.targetScale
724728 }
725729
726730// onXChanged: if (model.application.appId == "unity8-dash") print("dash moved to", x)
@@ -733,10 +737,11 @@ AbstractStage {
733737 target: decoratedWindow;
734738 showDecoration: false;
735739 angle: spreadMaths.targetAngle
736− itemScale: spreadMaths.scale
740+ itemScale: spreadMaths.targetScale
737741 scaleToPreviewSize: spreadItem.stackHeight
738742 scaleToPreviewProgress: 1
739743 hasDecoration: root.mode === "windowed"
744+ shadowOpacity: .3
740745 }
741746 PropertyChanges {
742747 target: appDelegate
@@ -756,10 +761,11 @@ AbstractStage {
756761 PropertyChanges {
757762 target: stagedRightEdgeMaths
758763 progress: rightEdgeDragArea.progress
764+ startY: appDelegate.fullscreen ? 0 : PanelState.panelHeight
759765 }
760766 PropertyChanges {
761767 target: appDelegate
762− y: PanelState.panelHeight
768+ y: stagedRightEdgeMaths.animatedY
763769 x: stagedRightEdgeMaths.animatedX
764770 z: index +1
765771 height: stagedRightEdgeMaths.animatedHeight
@@ -770,8 +776,10 @@ AbstractStage {
770776 target: decoratedWindow;
771777 hasDecoration: false
772778 angle: stagedRightEdgeMaths.animatedAngle
779+ itemScale: stagedRightEdgeMaths.animatedScale
773780 scaleToPreviewSize: spreadItem.stackHeight
774− scaleToPreviewProgress: stagedRightEdgeMaths.progress
781+ scaleToPreviewProgress: stagedRightEdgeMaths.scaleToPreviewProgress
782+ shadowOpacity: 0.3
775783 }
776784 },
777785 State {
@@ -781,7 +789,7 @@ AbstractStage {
781789 x: appDelegate.focus ? 0 : root.width
782790 y: appDelegate.fullscreen ? 0 : PanelState.panelHeight
783791 requestedWidth: appContainer.width
784− requestedHeight: appContainer.height - PanelState.panelHeight
792+ requestedHeight: appDelegate.fullscreen ? appContainer.height : appContainer.height - PanelState.panelHeight
785793 visuallyMaximized: true
786794 }
787795 PropertyChanges {
@@ -854,6 +862,7 @@ AbstractStage {
854862 }
855863 PropertyChanges { target: touchControls; enabled: true }
856864 PropertyChanges { target: resizeArea; enabled: true }
865+ PropertyChanges { target: decoratedWindow; shadowOpacity: .3}
857866 },
858867 State {
859868 name: "maximizedLeft"; when: appDelegate.maximizedLeft && !appDelegate.minimized
@@ -866,6 +875,7 @@ AbstractStage {
866875 target: decoratedWindow
867876 requestedWidth: (appContainer.width - root.leftMargin)/2
868877 requestedHeight: appContainer.height - PanelState.panelHeight
878+ shadowOpacity: .3
869879 }
870880 },
871881 State {
@@ -879,17 +889,26 @@ AbstractStage {
879889 target: decoratedWindow
880890 requestedWidth: (appContainer.width - root.leftMargin)/2
881891 requestedHeight: appContainer.height - PanelState.panelHeight
892+ shadowOpacity: .3
882893 }
883894 },
884895 State {
885896 name: "maximizedHorizontally"; when: appDelegate.maximizedHorizontally && !appDelegate.minimized
886897 PropertyChanges { target: appDelegate; x: root.leftMargin }
887− PropertyChanges { target: decoratedWindow; requestedWidth: appContainer.width - root.leftMargin }
898+ PropertyChanges {
899+ target: decoratedWindow;
900+ requestedWidth: appContainer.width - root.leftMargin
901+ shadowOpacity: .3
902+ }
888903 },
889904 State {
890905 name: "maximizedVertically"; when: appDelegate.maximizedVertically && !appDelegate.minimized
891906 PropertyChanges { target: appDelegate; y: PanelState.panelHeight }
892− PropertyChanges { target: decoratedWindow; requestedHeight: appContainer.height - PanelState.panelHeight }
907+ PropertyChanges {
908+ target: decoratedWindow;
909+ requestedHeight: appContainer.height - PanelState.panelHeight
910+ shadowOpacity: .3
911+ }
893912 },
894913 State {
895914 name: "minimized"; when: appDelegate.minimized
@@ -912,7 +931,7 @@ AbstractStage {
912931 UbuntuNumberAnimation { target: appDelegate; properties: "x,y,opacity,requestedWidth,requestedHeight,scale"; duration: priv.animationDuration }
913932 },
914933 Transition {
915− from: "spread"; to: "staged,normal"
934+ from: "spread"; to: "*"
916935// UbuntuNumberAnimation { target: appDelegate; properties: "x,y,height"; duration: priv.animationDuration }
917936// UbuntuNumberAnimation { target: decoratedWindow; properties: "width,height,itemScale,angle"; duration: priv.animationDuration }
918937 ScriptAction { script: if (appDelegate.focus) appDelegate.playFocusAnimation() }
@@ -1068,15 +1087,6 @@ AbstractStage {
10681087 }
10691088 ]
10701089 }
1071− BorderImage {
1072− anchors {
1073− fill: decoratedWindow
1074− margins: /*active ? -units.gu(2) : */-units.gu(1.5)
1075− }
1076− source: "graphics/dropshadow2gu.sci"
1077− opacity: root.shadowOpacity * .3
1078− visible: false
1079− }
10801090
10811091
10821092 WindowControlsOverlay {
@@ -1199,7 +1209,7 @@ AbstractStage {
11991209 // A potential edge-drag gesture has started. Start recording it
12001210 gesturePoints = [];
12011211 } else {
1202− if (gesturePoints[gesturePoints.length - 1] < -root.width / 2) {
1212+ if (gesturePoints[gesturePoints.length - 1] < -root.width * 0.4 ) {
12031213 priv.goneToSpread = true;
12041214 } else {
12051215 if (appRepeater.count > 1) {
qml/Stages/Spread/SpreadMaths.qml+1−1
@@ -49,7 +49,7 @@ Item {
4949 Math.min(spread.dynamicLeftRotationAngle, spread.dynamicRightRotationAngle), Math.max(spread.dynamicLeftRotationAngle, spread.dynamicRightRotationAngle))
5050
5151
52− readonly property real scale: MathUtils.clamp(
52+ readonly property real targetScale: MathUtils.clamp(
5353 MathUtils.map(spreadPosition, 0, 1, spread.leftStackScale, spread.rightStackScale),
5454 spread.leftStackScale, spread.rightStackScale)
5555
qml/Stages/Spread/StagedRightEdgeMaths.qml+35−12
@@ -11,34 +11,57 @@ QtObject {
1111 property int sceneWidth: 0
1212 property int sceneHeight: 0
1313 property int targetX: 0
14− property int targetAngle: 0
14+ property int startY: 0
15+ property int targetY: 0
16+ property real startAngle: 40
17+ property real targetAngle: 0
1518 property int targetHeight: 0
19+ property real startScale: 1.3
20+ property real targetScale: 0
21+
1622
1723 onProgressChanged: if (itemIndex == 0) { print("progress", progress) }
1824
25+ // Config
26+ property real breakPoint: 0.4
27+ property int tileDistance: units.gu(10)
28+
1929 // Output
2030
31+ readonly property real scaleToPreviewProgress: {
32+ print("scaleProg:", progress < breakPoint ? 0 : MathUtils.linearAnimation(breakPoint, 1.0, 0.0, 1.0, progress))
33+ return progress < breakPoint ? 0 : MathUtils.linearAnimation(0.5, 1.0, 0.0, 1.0, progress)
34+ }
2135 readonly property int animatedWidth: {
22− return MathUtils.linearAnimation(0, 1, root.sceneWidth, targetHeight, progress)
36+ return progress < breakPoint ? root.sceneHeight : MathUtils.linearAnimation(breakPoint, 1, root.sceneWidth, targetHeight, progress)
2337 }
2438
2539 readonly property int animatedHeight: {
26− print("animatedHeight:", progress < 0.5 ? root.sceneHeight : MathUtils.linearAnimation(0.5, 1, root.sceneHeight, targetHeight, progress))
27− return progress < 0.5 ? root.sceneHeight : MathUtils.linearAnimation(0.5, 1, root.sceneHeight, targetHeight, progress)
40+ return progress < breakPoint ? root.sceneHeight : MathUtils.linearAnimation(breakPoint, 1, root.sceneHeight, targetHeight, progress)
2841 }
2942
3043 readonly property int animatedX: {
3144 if (itemIndex == 0) {
32− // aX : tX = p : 1
3345 return root.targetX * root.progress
3446 }
35− var startX = sceneWidth + (root.itemIndex - 1) * units.gu(10)
36− var distance = startX - root.targetX
37− return startX - distance * root.progress;
47+ var startX = sceneWidth //+ (itemIndex - 1) * tileDistance
48+ if (itemIndex == 1) {
49+ if (root.progress < breakPoint) {
50+ return MathUtils.linearAnimation(0, breakPoint, startX, startX / 2 + (itemIndex - 1) * tileDistance, progress)
51+ }
52+ return MathUtils.linearAnimation(breakPoint, 1, startX / 2 + (itemIndex - 1) * tileDistance, targetX, progress)
53+ }
54+ if (progress < breakPoint) {
55+ return startX
56+ }
57+ return MathUtils.linearAnimation(breakPoint, 1, startX, targetX, progress)
3858 }
3959
40− readonly property real animatedAngle: {
41− // a : tA = p : 1
42− return root.targetAngle * root.progress
43− }
60+ readonly property int animatedY: progress < breakPoint ? startY : MathUtils.linearAnimation(breakPoint, 1, startY, targetY, progress)
61+
62+ readonly property real animatedAngle: itemIndex == 0 ? MathUtils.linearAnimation(0, 1, 0, targetAngle, progress)
63+ : Math.max(MathUtils.linearAnimation(0, breakPoint, startAngle, targetAngle, progress), targetAngle)
64+
65+ readonly property real animatedScale: itemIndex == 0 ? MathUtils.linearAnimation(0, 1, 1, targetScale, progress)
66+ : MathUtils.linearAnimation(0, 1, startScale, targetScale, progress)
4467}