phaserjs / phaser

Phaser is a fun, free and fast 2D game framework for making HTML5 games for desktop and mobile web browsers, supporting Canvas and WebGL rendering.
https://phaser.io
MIT License
37.2k stars 7.1k forks source link

scaleManager.isPortrait and scaleManager.isLandscape #6837

Closed rexrainbow closed 5 months ago

rexrainbow commented 5 months ago

Version

Description

4 results (portrait-primary, landscape-primary, portrait-secondary, landscape-secondary) returned when orientation-changed. However, phaser3 engine tests isPortrait, isLandscape with 'portrait-primary', 'landscape-primary' only (ref) Thus it will miss 'portrait-secondary', 'landscape-secondary'. In these orientation states, isPortrait, isLandscape are return false.

Test code, rotate mobile device to change orientation

rexrainbow commented 5 months ago

BTW, Window: orientationchange event is deprecated

zekeatchan commented 5 months ago

Hi @rexrainbow. Thank you for submitting this feature request.

We have implemented:

  1. additional landscape-secondary and portrait-secondary orientation change events
  2. updated the handlers to use the screen.orientation change event

These updates have been pushed to the master branch and will be part of the next release. Do test it out at your convenience.