ScaleManager#onOrientationChange

onOrientationChange : Phaser.Signal

This signal is dispatched when the orientation changes or the validity of the current orientation changes.

The signal is supplied with the following arguments:

  • scale - the ScaleManager object
  • prevOrientation, a string - The previous orientation as per screenOrientation.
  • wasIncorrect, a boolean - True if the previous orientation was last determined to be incorrect.

Access the current orientation and validity with scale.screenOrientation and scale.incorrectOrientation.
Thus the following tests can be done:

// The orientation itself changed:
scale.screenOrientation !== prevOrientation
// The orientation just became incorrect:
scale.incorrectOrientation && !wasIncorrect

It is possible that this signal is triggered after forceOrientation so the orientation
correctness changes even if the orientation itself does not change.

This is signaled from preUpdate (or pauseUpdate) even when the game is paused.

Source code: core/ScaleManager.js (Line 201)
doc_phaser
2017-02-14 11:09:10
Comments
Leave a Comment

Please login to continue.