Removed references of TouchEvent.

It breaks on Firefox on desktop because the `TouchEvent` type is not defined.
This commit is contained in:
Fabio Manganiello 2025-04-08 12:28:28 +02:00
parent c8200bfcbf
commit 47aa2da6a2
Signed by: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -26,7 +26,7 @@ export default {
data() { data() {
return { return {
latestTouchEvent: null as TouchEvent | null, latestTouchEvent: null as any,
overlayDragging: false, overlayDragging: false,
selectionBox: [] as number[][], selectionBox: [] as number[][],
} }
@ -85,9 +85,9 @@ export default {
] ]
}, },
getXY(event: MouseEvent | TouchEvent): number[] { getXY(event: any): number[] {
let [x, y] = [null, null] as [number | null, number | null] let [x, y] = [null, null] as [number | null, number | null]
if (event instanceof TouchEvent) { if (event instanceof window.TouchEvent) {
if (event.touches?.length) { if (event.touches?.length) {
x = event.touches[0].clientX x = event.touches[0].clientX
y = event.touches[0].clientY y = event.touches[0].clientY
@ -112,7 +112,7 @@ export default {
return [x, y] return [x, y]
}, },
setSelectionBoxCoordinates(event: MouseEvent | TouchEvent) { setSelectionBoxCoordinates(event: any) {
const coords = this.getXY(event) const coords = this.getXY(event)
let newBox = JSON.parse(JSON.stringify(this.selectionBox)) as number[][] let newBox = JSON.parse(JSON.stringify(this.selectionBox)) as number[][]
@ -126,13 +126,13 @@ export default {
this.selectionBox = newBox this.selectionBox = newBox
}, },
onSelectionStart(event: MouseEvent | TouchEvent) { onSelectionStart(event: any) {
this.selectionBox = [] this.selectionBox = []
this.setSelectionBoxCoordinates(event) this.setSelectionBoxCoordinates(event)
this.overlayDragging = true this.overlayDragging = true
}, },
onSelectionEdit(event: MouseEvent | TouchEvent) { onSelectionEdit(event: any) {
if (!this.overlayDragging || this.selectionBox.length < 1) { if (!this.overlayDragging || this.selectionBox.length < 1) {
return return
} }
@ -140,7 +140,7 @@ export default {
this.setSelectionBoxCoordinates(event) this.setSelectionBoxCoordinates(event)
}, },
onSelectionEnd(event: MouseEvent | TouchEvent) { onSelectionEnd(event: any) {
if (this.selectionBox.length < 1) { if (this.selectionBox.length < 1) {
this.selectionBox = [] this.selectionBox = []
return return