Fix responsive Camera Settings

This commit is contained in:
Gregoire Parant 2021-04-22 11:47:59 +02:00
parent 3df32de83b
commit 3697ddabfa
3 changed files with 11 additions and 9 deletions

View file

@ -112,12 +112,14 @@ export class HelpCameraSettingsScene extends Phaser.Scene {
}
private getMiddleX() : number{
const middleX = ((window.innerWidth) - ((
return (this.game.renderer.width / 2) -
(
this.helpCameraSettingsElement
&& this.helpCameraSettingsElement.node
&& this.helpCameraSettingsElement.node.getBoundingClientRect().width > 0
? this.helpCameraSettingsElement.node.getBoundingClientRect().width : 300 /*FIXME to use a const will be injected in HTMLElement*/)*2)) / 2;
return (middleX > 0 ? middleX / 2 : 0);
? (this.helpCameraSettingsElement.node.getBoundingClientRect().width / 4)
: (400 / 2)
);
}
private getMiddleY() : number{