selezione riscaldi con touch

This commit is contained in:
=
2020-06-29 13:53:16 +02:00
parent 59051dc908
commit 1b31f05fb2
2 changed files with 17 additions and 3 deletions
@@ -196,11 +196,22 @@ export default class Warmers extends Vue {
}
}
getSvgCoords(evt: MouseEvent): selectionPoint {
getSvgCoords(evt: MouseEvent | TouchEvent): selectionPoint {
var e = this.$refs.warmer as any;
var dim = e.getBoundingClientRect();
var x = evt.clientX - dim.left;
var y = evt.clientY - dim.top;
var x = null;
var y = null;
if ((evt as TouchEvent).touches)
for (const touch of Array.from((evt as TouchEvent).touches).slice(0, 1)) {
x = touch.clientX - dim.left;
y = touch.clientY - dim.top;
}
else {
x = (evt as MouseEvent).clientX - dim.left;
y = (evt as MouseEvent).clientY - dim.top;
}
let sizes = this.zoomController?.getSizes();
let pan = this.zoomController?.getPan();
x -= pan.x;
@@ -4,6 +4,9 @@
@mousedown="startSelection"
@mouseup="stopSelection"
@mousemove.capture="moveSelection"
v-on:touchstart="startSelection"
v-on:touchend="stopSelection"
v-on:touchmove="moveSelection"
>
<g>
<g v-for="row in rows" :key="row">