redraw on screenSize and clear if controlling.

This commit is contained in:
Miroslav Šedivý 2021-02-18 21:09:08 +01:00
parent 6340da049b
commit 8bee5222b1

View File

@ -278,12 +278,26 @@
private cursorElement: HTMLImageElement = new Image() private cursorElement: HTMLImageElement = new Image()
private cursorPosition: { x: number; y: number } | null = null private cursorPosition: { x: number; y: number } | null = null
@Watch('screenSize')
onScreenSizeChange() {
if (this.isControling) {
this.canvasClear()
} else {
this.canvasRedraw()
}
}
@Watch('canvasSize') @Watch('canvasSize')
onCanvasSizeChange({ width, height }: { width: number; height: number }) { onCanvasSizeChange({ width, height }: { width: number; height: number }) {
this._overlay.width = width this._overlay.width = width
this._overlay.height = height this._overlay.height = height
if (this.isControling) {
this.canvasClear()
} else {
this.canvasRedraw() this.canvasRedraw()
} }
}
onCursorPosition(data: { x: number; y: number }) { onCursorPosition(data: { x: number; y: number }) {
if (!this.isControling) { if (!this.isControling) {