This is now hopefuly solved with the Github version...
In the Github version you can now adjust the zoom percentage (minimum value is 100%):
This was again a brain breaker... At the end I found this:
Since the upper left corner of the drawing was the center of animation, the circly would have moved to that point ...
So now I pass the (client) coordinates - where you have double clicked/tapped - to the zoom function, to make sure that point is the center of the animation:
Don't understand exactly what is going on...
I fixed one thing, but I'm not sure whether it will entirely solve your problem: in the input msg ({"command":"zoom_by_percentage","percentage":300,"x":300,"y":30}) you specify SVG coordinates, because it it are the coordinates relative to the upper left point of your drawing. However the zoomtopoint function expects client coordinates, i.e. relative to your browser window. When I have a circle at (100, 100), I can now zoom in on it - similar to the above double click animation - by injecting your message:
But I have a bad feeling that this this client coordinate fix is not end of story yet ...
So you inject a message with SVG coordinates, i.e. and X and Y coordinate relative to the green origin.
But the PanZoom library (zoomToPoint) expects client coordinates, i.e. relative to the red origin.
=> I now convert your SVG coordinates to client coordinates: clientX = yourSvgX + svgDrawingOriginX
Hopefully this gives you some insights, and you can give me some more tips of where it might go wrong ...
Ooooooh, so glad it works...
At the time being I had to replace quickly the underlying panzoom library, because the previous one seemed not to be maintained anymore. But had no time unfortunately to test it in detail like you did now.
Anyway hopefully others can benefit now from it.
I will release this as soon on NPM...