Merge pull request #838 from thecodingmachine/fixChromeResize
FIX: resizing on wide screen on chrome now use the correct coordinates
This commit is contained in:
commit
30e12702eb
@ -140,7 +140,7 @@ export class MenuScene extends Phaser.Scene {
|
|||||||
this.warningContainer?.destroy();
|
this.warningContainer?.destroy();
|
||||||
this.warningContainer = null
|
this.warningContainer = null
|
||||||
this.warningContainerTimeout = null
|
this.warningContainerTimeout = null
|
||||||
}, 2000);
|
}, 120000);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class CoWebsiteManager {
|
|||||||
|
|
||||||
private initResizeListeners() {
|
private initResizeListeners() {
|
||||||
const movecallback = (event:MouseEvent) => {
|
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();
|
this.fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,6 +92,12 @@ class CoWebsiteManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
private close(): void {
|
||||||
this.cowebsiteDiv.classList.remove('loaded'); //edit the css class to trigger the transition
|
this.cowebsiteDiv.classList.remove('loaded'); //edit the css class to trigger the transition
|
||||||
this.cowebsiteDiv.classList.add('hidden');
|
this.cowebsiteDiv.classList.add('hidden');
|
||||||
|
Loading…
Reference in New Issue
Block a user