setResizeCallback(callback, context)
Sets the callback that will be invoked before sizing calculations.
This is the appropriate place to call setUserScale if needing custom dynamic scaling.
The callback is supplied with two arguments scale
and parentBounds
where scale
is the ScaleManager
and parentBounds
, a Phaser.Rectangle, is the size of the Parent element.
This callback
- May be invoked even though the parent container or canvas sizes have not changed
- Unlike onSizeChange, it runs before the canvas is guaranteed to be updated
- Will be invoked from
preUpdate
, even when the game is paused
See onSizeChange for a better way of reacting to layout updates.
Parameters
Name | Type | Description |
---|---|---|
callback | function | The callback that will be called each time a window.resize event happens or if set, the parent container resizes. |
context | object | The context in which the callback will be called. |
- Source code: core/ScaleManager.js (Line 933)
Please login to continue.