Skip to content Skip to sidebar Skip to footer

Cursor Location After Zoom Using Svg-pan-zoom

I am using the ariutta svg-pan-zoom library. I have a SVG file with viewBox='0 0 1052.3622 744.09448' and div container with width=649 and heigth=525,59. I'm trying to get cursor l

Solution 1:

I'm an idiot! I had a bug in the other part of my code. That is why I thought that the y value was correct for zoom == 1 - in fact it wasn't.

This works for me:

var y = (panZoomHeight - divY - (panZoomHeight-(viewboxHeight*realZoom)) + currentPan.y) / realZoom;    

Post a Comment for "Cursor Location After Zoom Using Svg-pan-zoom"