-
Notifications
You must be signed in to change notification settings - Fork 0
render_mpl and render_animation ignore ViewState.zoom #46
Description
Summary
The auto-fit viewport path in _draw_scene computes axis limits from the projected bounding box of all atoms. Since ViewState.zoom scales the projected coordinates, a larger zoom produces a proportionally larger bounding box -- the viewport expands to fit and the zoom has no visible effect.
This means:
- Setting
view.zoomin the interactive viewer, then callingrender_mpl()produces the same output regardless of zoom level. - The intended workflow of "dial in the view interactively, then render" does not work for zoom.
render_animationinherits the same issue.
Rotation, pan (view.centre), and perspective are all respected correctly. Only zoom is broken in the auto-fit path.
Expected behaviour
zoom > 1 should show a cropped/zoomed-in view of the scene. zoom < 1 should show the scene with more padding around it.
Root cause
_draw_scene in painter.py (auto-fit path, lines ~800-805) computes pad_x and pad_y from the projected coordinates, which already have zoom applied via ViewState.project(). The zoom scales both the coordinates and the bounding box equally, so they cancel out.