I’ve noticed an issue with zoom behavior after resizing the viewer. When I call:
instance.resize(); // instance: Viewer
It seems that the zoom still operates based on the old camera center. For example, if I place my mouse pointer in the middle-left of the screen and zoom in, instead of zooming towards the cursor position, the model zooms towards the (probably old) scene center.
I suspect that I need to adjust orbit controls properly after resizing, but I’m not sure how to do this here.
What’s the correct way to ensure that zooming follows the cursor position after resizing the viewer?
Simply calling resize will not break zooming to cursor on it’s own. There is no need to anything extra to the camera controls. I have a feeling this happens on specific page layouts/setups where the viewer is part of a more complicate(or not) hierarchy of elements.
We would need an example that reproduces the issue. Maybe a stackblitz live example?
Actually, as it turns out, the problem is not with the resize() method. The issue is that my parent container is relative. (I made it relative because I have many tools that must be positioned absolute within this container).
But how can position break the viewer?