DOM Element game resize at the same time and the same size at the canvas of phaser

Remove VisitCard scss unused
This commit is contained in:
GRL 2021-06-09 18:08:14 +02:00
parent 61180a6e64
commit 6868128267
3 changed files with 8 additions and 13 deletions

View file

@ -39,6 +39,14 @@ class WaScaleManager {
const style = this.scaleManager.canvas.style;
style.width = Math.ceil(realSize.width / devicePixelRatio) + 'px';
style.height = Math.ceil(realSize.height / devicePixelRatio) + 'px';
// Resize the game element at the same size at the canvas
const gameStyle = document.getElementById('game')?.style;
if (gameStyle != undefined) {
gameStyle.height = style.height;
gameStyle.width = style.width;
}
// Note: onResize will be called twice (once here and once is Game.ts), but we have no better way.
for (const scene of this.game.scene.getScenes(true)) {
if (scene instanceof ResizableScene) {