It breaks on Firefox on desktop because the `TouchEvent` type is not defined.
This commit is contained in:
parent
c8200bfcbf
commit
47aa2da6a2
1 changed files with 7 additions and 7 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue