Suggestion to get exact mouse position
savi8sant8s opened this issue · comments
Sávio Santos commented
...
if (e.type === "touchmove") {
this.mouse_x = e_pos_x;
this.mouse_y = e_pos_y;
}
this.dispatch('mouseMove', {x: e_pos_x,y: e_pos_y });
//Exact mouse position
const mouse_pos_x = e_pos_x * ( this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) - (this.precanvas.getBoundingClientRect().x * ( this.precanvas.clientWidth / (this.precanvas.clientWidth * this.zoom)) );
const mouse_pos_y = e_pos_y * ( this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) - (this.precanvas.getBoundingClientRect().y * ( this.precanvas.clientHeight / (this.precanvas.clientHeight * this.zoom)) );
this.dispatch('mouseMoveExact', {x: mouse_pos_x,y: mouse_pos_y });
...