@@ -131,6 +131,14 @@ FocusScope {
131131 }
132132 }
133133
134+ // Ensures the given angle is in the form (0,90,180,270)
135+ function normalizeAngle(angle) {
136+ while (angle < 0) {
137+ angle += 360;
138+ }
139+ return angle % 360;
140+ }
141+
134142 states: [
135143 // Sets the initial orientationAngle of the window, when it first slides into view
136144 // (with the splash screen likely being displayed). At that point we just try to
@@ -172,16 +180,16 @@ FocusScope {
172180 return Screen.angleBetween(root.nativeOrientation, chosenOrientation);
173181 }
174182
175− rotation: appWindowWithShadow.orientationAngle - root.shellOrientationAngle
183+ rotation: normalizeAngle(appWindowWithShadow.orientationAngle - root.shellOrientationAngle)
176184 width: {
177− if (rotation == 0 || Math.abs(rotation) == 180) {
185+ if (rotation == 0 || rotation == 180) {
178186 return root.width;
179187 } else {
180188 return root.height;
181189 }
182190 }
183191 height: {
184− if (rotation == 0 || Math.abs(rotation) == 180)
192+ if (rotation == 0 || rotation == 180)
185193 return root.height;
186194 else
187195 return root.width;
@@ -201,16 +209,16 @@ FocusScope {
201209 PropertyChanges {
202210 target: appWindowWithShadow
203211 restoreEntryValues: false
204− rotation: appWindowWithShadow.orientationAngle - root.shellOrientationAngle
212+ rotation: normalizeAngle(appWindowWithShadow.orientationAngle - root.shellOrientationAngle)
205213 width: {
206− if (rotation == 0 || Math.abs(rotation) == 180) {
214+ if (rotation == 0 || rotation == 180) {
207215 return root.width;
208216 } else {
209217 return root.height;
210218 }
211219 }
212220 height: {
213− if (rotation == 0 || Math.abs(rotation) == 180)
221+ if (rotation == 0 || rotation == 180)
214222 return root.height;
215223 else
216224 return root.width;
@@ -229,7 +237,7 @@ FocusScope {
229237 target: appWindowWithShadow
230238 width: root.shellOrientationAngle == 0 || root.shellOrientationAngle == 180 ? root.width : root.height
231239 height: root.shellOrientationAngle == 0 || root.shellOrientationAngle == 180 ? root.height : root.width
232− rotation: -root.shellOrientationAngle
240+ rotation: normalizeAngle(-root.shellOrientationAngle)
233241 }
234242 PropertyChanges {
235243 target: appWindow