FIX: resizing on wide screen on chrome now use the correct coordinates
This commit is contained in:
parent
dc1a5da175
commit
99e6743c01
@ -140,7 +140,7 @@ export class MenuScene extends Phaser.Scene {
|
||||
this.warningContainer?.destroy();
|
||||
this.warningContainer = null
|
||||
this.warningContainerTimeout = null
|
||||
}, 2000);
|
||||
}, 120000);
|
||||
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ class CoWebsiteManager {
|
||||
|
||||
private initResizeListeners() {
|
||||
const movecallback = (event:MouseEvent) => {
|
||||
this.verticalMode ? this.height -= event.movementY : this.width -= event.movementX;
|
||||
this.verticalMode ? this.height -= event.movementY / this.getDevicePixelRatio() : this.width -= event.movementX / this.getDevicePixelRatio();
|
||||
this.fire();
|
||||
}
|
||||
|
||||
@ -91,6 +91,12 @@ class CoWebsiteManager {
|
||||
this.resizing = false;
|
||||
});
|
||||
}
|
||||
|
||||
private getDevicePixelRatio(): number {
|
||||
//on chrome engines, movementX and movementY return global screens coordinates while other browser return pixels
|
||||
//so on chrome-based browser we need to adjust using 'devicePixelRatio'
|
||||
return window.navigator.userAgent.includes('Firefox') ? 1 : window.devicePixelRatio;
|
||||
}
|
||||
|
||||
private close(): void {
|
||||
this.cowebsiteDiv.classList.remove('loaded'); //edit the css class to trigger the transition
|
||||
|
Loading…
Reference in New Issue
Block a user