Merge pull request #1182 from thecodingmachine/fix_viewport_on_resize
Fixing size of camera on resize
This commit is contained in:
commit
0172d7dc3b
@ -39,10 +39,11 @@ class WaScaleManager {
|
||||
const style = this.scaleManager.canvas.style;
|
||||
style.width = Math.ceil(realSize.width / devicePixelRatio) + 'px';
|
||||
style.height = Math.ceil(realSize.height / devicePixelRatio) + 'px';
|
||||
// Note: onResize will be called twice (once here and once is Game.ts), but we have no better way.
|
||||
// Note: onResize will be called twice (once here and once in Game.ts), but we have no better way.
|
||||
for (const scene of this.game.scene.getScenes(true)) {
|
||||
if (scene instanceof ResizableScene) {
|
||||
scene.onResize();
|
||||
// We are delaying the call to the "render" event because otherwise, the "camera" coordinates are not correctly updated.
|
||||
scene.events.once(Phaser.Scenes.Events.RENDER, () => scene.onResize());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user