From d26502a724a01e6a9dac2f8e3ba641b314b8142f Mon Sep 17 00:00:00 2001 From: GRL Date: Thu, 10 Jun 2021 09:23:25 +0200 Subject: [PATCH] Use HtmlUtils to get DOM Element game --- front/src/Phaser/Services/WaScaleManager.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/front/src/Phaser/Services/WaScaleManager.ts b/front/src/Phaser/Services/WaScaleManager.ts index cf10f195..52e5e14a 100644 --- a/front/src/Phaser/Services/WaScaleManager.ts +++ b/front/src/Phaser/Services/WaScaleManager.ts @@ -3,6 +3,8 @@ import ScaleManager = Phaser.Scale.ScaleManager; import {coWebsiteManager} from "../../WebRtc/CoWebsiteManager"; import type {Game} from "../Game/Game"; import {ResizableScene} from "../Login/ResizableScene"; +import {HtmlUtils} from "../../WebRtc/HtmlUtils"; +import {INPUT_CONSOLE_MESSAGE} from "../../Administration/ConsoleGlobalMessageManager"; class WaScaleManager { @@ -41,11 +43,9 @@ class WaScaleManager { 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; - } + const gameStyle = HtmlUtils.getElementByIdOrFail('game').style; + 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)) {