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

@ -17,17 +17,6 @@
width: 530px;
margin-top: 200px;
max-width: 100vw;
.defaultCard {
border-radius: 5px;
border: 2px black solid;
background-color: whitesmoke;
width: 530px;
header {
padding: 5px;
}
}
iframe {
border: 0;

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) {

View file

@ -367,8 +367,6 @@ body {
}
#game {
height: 100%;
width: 100%;
position: relative; /* Position relative is needed for the game-overlay. */
}