Keeping focus during zoom



As you can see from the above gif, if the mouse is at some location and one uses the scroll wheel for zooming in, the mouse pointer does not stay at the same location.
Is there a way to solve this ?

Well, it tries to keep the mouse at the same point in model coordinates, but if it is not allowed to scroll far enough to achieve that, then it cannot.

You’ll note that when you have zoomed in far enough so that the diagram contents fill the viewport, it does a good job keeping the mouse at the same model coordinates point. It’s only when you are zoomed out far enough that it might not be possible.

Say for example that the contents are supposed to be at the top-left corner, but the mouse is near the bottom-right corner. Clearly as one zooms out all of the nodes and links are going to get closer to the top-left corner of the viewport, but the mouse still hasn’t moved within the viewport, so the mouse cannot remain within the diagram bounds.