minor bugfix in screen scaling
This commit is contained in:
parent
b87abde238
commit
3b4d6ce6df
|
|
@ -416,11 +416,15 @@ export default class CollabVMClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
private onWindowResize(e: Event) {
|
private onWindowResize(e: Event) {
|
||||||
var copyctx = (this.actualScreenSize.width !== this.canvasScale.width || this.actualScreenSize.height !== this.canvasScale.height) ? this.unscaledCanvas : this.canvas;
|
var t = setTimeout(() => {
|
||||||
this.recalculateCanvasScale(this.actualScreenSize.width, this.actualScreenSize.height);
|
if (!this.connectedToVM) return;
|
||||||
this.canvas.width = this.canvasScale.width;
|
var copyctx = (this.actualScreenSize.width !== this.canvasScale.width || this.actualScreenSize.height !== this.canvasScale.height) ? this.unscaledCanvas : this.canvas;
|
||||||
this.canvas.height = this.canvasScale.height;
|
this.recalculateCanvasScale(this.actualScreenSize.width, this.actualScreenSize.height);
|
||||||
this.ctx.drawImage(copyctx, 0, 0, this.actualScreenSize.width, this.actualScreenSize.height, 0, 0, this.canvas.width, this.canvas.height);
|
this.canvas.width = this.canvasScale.width;
|
||||||
|
this.canvas.height = this.canvasScale.height;
|
||||||
|
this.ctx.drawImage(copyctx, 0, 0, this.actualScreenSize.width, this.actualScreenSize.height, 0, 0, this.canvas.width, this.canvas.height);
|
||||||
|
}, 500);
|
||||||
|
window.addEventListener('resize', () => clearTimeout(t), {once: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
private recalculateCanvasScale(width: number, height: number) {
|
private recalculateCanvasScale(width: number, height: number) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user