Fixing "camera popup" always display on resize

This fixes a bug where the "camera popup" window was always displayed when the screen was resized.
This commit is contained in:
David Négrier 2021-05-10 19:05:01 +02:00
parent 58482f8ae6
commit 0411d5e493
1 changed files with 12 additions and 9 deletions

View File

@ -109,15 +109,18 @@ export class HelpCameraSettingsScene extends DirtyScene {
public onResize(ev: UIEvent): void { public onResize(ev: UIEvent): void {
super.onResize(ev); super.onResize(ev);
const middleX = this.getMiddleX(); if (this.helpCameraSettingsOpened) {
const middleY = this.getMiddleY(); const middleX = this.getMiddleX();
this.tweens.add({ const middleY = this.getMiddleY();
targets: this.helpCameraSettingsElement, this.tweens.add({
x: middleX, targets: this.helpCameraSettingsElement,
y: middleY, x: middleX,
duration: 1000, y: middleY,
ease: 'Power3' duration: 1000,
}); ease: 'Power3'
});
this.dirty = true;
}
} }
private getMiddleX() : number{ private getMiddleX() : number{