I am using fabric JS 4.5 and need to capture mouse click. The mouse click cordinates could change based on canvas resize or zoom . I was able to handle the resize issue but stuck in zoom.
Assume that I click on canvas at point (x1,y1) at zoom level 1. Now when I zoom , the same point would now be at (x2, y2) . I wanted to convert (x2, y2) to (x1, y1) . What fabric utils / functions could I use ? In other words if I know the zoom level and clicked point, I need to convert that point to a space where the the canvas would be at default zoom( which is 1 ) . We can assume that canvas width and height is a constant ( have already solved dynamic sizes ) . This convertion is not to render that point , but send it to an API
Referred to the documentation, transformation matrices and several questions but was unable to find this and my vecor background is not strong.
Explored the getPointer and ignoreZoom functionality but that didn't work:
this.canvas.getPointer(event.e, true)