2 * Copyright (C) 2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 property int fromAngle
27 readonly property real fromY: fromAngle === 0 || fromAngle === 90 ? 0 : orientedShell.height - orientedShell.width;
28 readonly property real toY: toAngle === 0 || toAngle === 90 ? 0 : orientedShell.height - orientedShell.width;
29 readonly property bool flipShellDimensions: toAngle == 90 || toAngle == 270
31 ScriptAction { script: {
32 info.transitioning = true;
33 windowScreenshot.take();
34 windowScreenshot.visible = true;
35 shell.orientationAngle = root.toAngle;
37 shell.width = flipShellDimensions ? orientedShell.height : orientedShell.width;
38 shell.height = flipShellDimensions ? orientedShell.width : orientedShell.height;
39 shell.transformOriginX = orientedShell.width / 2;
40 shell.transformOriginY = orientedShell.width / 2;
41 shell.updateFocusedAppOrientation();
42 shellCover.visible = true;
44 windowScreenshot.transformOriginX = orientedShell.width / 2;
45 if (fromAngle == 180 || fromAngle == 270) {
46 windowScreenshot.transformOriginY = orientedShell.height - (orientedShell.width / 2);
48 windowScreenshot.transformOriginY = orientedShell.width / 2;
53 target: shellCover; property: "opacity"; from: 1; to: 0;
54 duration: rotationDuration; easing.type: rotationEasing
57 target: shell; property: "transformRotationAngle";
58 from: root.fromAngle; to: root.toAngle
59 direction: RotationAnimation.Shortest
60 duration: rotationDuration; easing.type: rotationEasing
63 target: shell; property: "y"
64 from: root.fromY; to: root.toY
65 duration: rotationDuration; easing.type: rotationEasing
69 target: windowScreenshot; property: "opacity"; from: 1; to: 0;
70 duration: rotationDuration; easing.type: rotationEasing
73 target: windowScreenshot; property: "transformRotationAngle";
74 from: 0; to: root.toAngle - root.fromAngle
75 direction: RotationAnimation.Shortest
76 duration: rotationDuration; easing.type: rotationEasing
79 target: windowScreenshot; property: "y"
80 from: 0; to: root.toY - root.fromY
81 duration: rotationDuration; easing.type: rotationEasing
84 ScriptAction { script: {
85 windowScreenshot.visible = false;
86 windowScreenshot.discard();
87 shellCover.visible = false;
88 info.transitioning = false;