codesandbox link: https://codesandbox.io/s/canvas-zoom-in-out-drag-5moy48
HI! I need to click on particular item on the canvas while zooming and moving functionalities also enable for canvas
But now i need to calculate the rectangle position relative to the canvas, after zoom the canvas. Whats the maths behind the zooming. If anyone knows please help in this. Thank you.
124 line
downHandler(ev: PointerDownEvent) {
const { clientX, clientY } = ev;
// How get current canvas position after zoom in/out or drag
const startX = ?;
const endX = ?;
const startY = ?;
const endY = ?;
if (
startX < clientX &&
endX > clientX &&
startY < clientY &&
endY > clientY
) {
// image canvas
}
}