From 0411d5e493d4db6c8b90d97d34838c101dc11759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 10 May 2021 19:05:01 +0200 Subject: [PATCH] Fixing "camera popup" always display on resize This fixes a bug where the "camera popup" window was always displayed when the screen was resized. --- .../Phaser/Menu/HelpCameraSettingsScene.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts index 429e197b..6e80b8d4 100644 --- a/front/src/Phaser/Menu/HelpCameraSettingsScene.ts +++ b/front/src/Phaser/Menu/HelpCameraSettingsScene.ts @@ -109,15 +109,18 @@ export class HelpCameraSettingsScene extends DirtyScene { public onResize(ev: UIEvent): void { super.onResize(ev); - const middleX = this.getMiddleX(); - const middleY = this.getMiddleY(); - this.tweens.add({ - targets: this.helpCameraSettingsElement, - x: middleX, - y: middleY, - duration: 1000, - ease: 'Power3' - }); + if (this.helpCameraSettingsOpened) { + const middleX = this.getMiddleX(); + const middleY = this.getMiddleY(); + this.tweens.add({ + targets: this.helpCameraSettingsElement, + x: middleX, + y: middleY, + duration: 1000, + ease: 'Power3' + }); + this.dirty = true; + } } private getMiddleX() : number{