Encountered a mobile terminal Sketchpad needs to be marked on the given image, the original image needs to be enlarged and then marked, I used CSS firsttransform:scale
Zoom in on the canvas, and then annotate, which will cause problems with the coordinates.
In my current method of obtaining coordinates, it’s ok if I don’t zoom. How to calculate the accurate coordinates after the canvas is enlarged?
function getPosition (e) {
e.preventDefault();
var touch = e.touches[0];
var x = touch.pageX;
var y = touch.pageY;
return {x, y}
}
The calculation is made by using the proportional relationship