Skip to content

Commit 0fd6a4a

Browse files
committed
ScaleManager - orientation
- FIX phaserjs#1306, hopefully, where an orientation change did not correclty cause a screen/layout update. - FIX/CHANGE where Paused games would not update the scale - The new behavior "runs" the ScaleManager in a paused state via `pauseUpdate`; a User paused game will now correctly track scale changes. This is closer to the 2.1.3 behavior in some cases, such as window resizing, when the updates were done in the DOM event. - This change also affects device orientation change monitoring and events, which are also deferred to the update cycle - The update cycle is set to the maximum and is still dependent on the RAF / primary loop running, so it should not affect background apps/tabs - FIX/CHANGE New better backoff timing; ie. continuous window resizing is limited to ~10 fps update calculations. This makes it much harder to crash Chrome by rapidly and continously resizing the window. Also increases the scaling from 0..10..20..40 to 0..25..50..100. - FIX an issue where the incorrect orientation was "one frame behind" the scaling. - UPDATE The contract for when the change orientation events occurs is better defined - it now always happens in the update context as with game sizing. - UPDATE Unifies orientation-change code / handling and duplicate. - CHANGE Added DOM.getScreenOrientation which obtains the orientation via the Device Orientation API (WD) and provides comprehensive fallbacks - This should cover all modern browsers - FIX: Orientation on desktops now computed as screen ratio by default which fixesi the false-portrait chain/detection when the page is made more narrow than it is tall. - CHANGE/FIX: window.orientation is now only used as fallback, if requested (due to device differences). It may be appropriate to enable this (via `scale.compatibility` on boot, for instance) in some environments. Signed-off-by: Paul <pstickne@gmail.com>
1 parent 642d535 commit 0fd6a4a

3 files changed

Lines changed: 257 additions & 136 deletions

File tree

src/core/Game.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,6 +797,9 @@ Phaser.Game.prototype = {
797797
}
798798
else
799799
{
800+
// Scaling and device orientation changes are still reflected when paused.
801+
this.scale.pauseUpdate();
802+
800803
this.state.pauseUpdate();
801804

802805
if (this.config['enableDebug'])

0 commit comments

Comments
 (0)