-
Notifications
You must be signed in to change notification settings - Fork 614
Description
Currently the panning and zooming of the 2D space views is handled by egui::ScrollArea. This has several down-sides, such as not being able to zoom out further than "full view".
We should instead allow any pan and zoom, treating it more similar to the 3D "eye".
This is the first step towards fixing a bunch of 2D issues:
- Configurable extent of 2D space views #683
- view_coordinates for 2D views #1387
- feature : viewpoint linking between spaces #294
- Always allow image to zoom out to 1:1 scale #2295
- Negative 2D points in image with pinhole transform lock 2D view to top-left corner #2490
- Explicit 2D viewport controls #1012
To start with, it's good enough to support just panning and uniform scaling.
In the future we may want to support non-uniform scaling (including mirroring), as well as rotation.
Parameterizations
- How do we represent this as components?
- How do we control this from code?
One important case to consider is for the user to be able to set some 'view bounds' for the 2D spatial view.
This should act as some minimum bounds, that can grow in order to keep the aspect ratio of the actual space view, adding letterboxing to maintain a uniform axis scaling.
Again, when the space view is resized we should always see everything in the set view rectangle, but at little as possible outside.
This is similar to how egui_plot works.
So that implies that perhaps the entire 2D Eye is parameterized as a bounding-box in the space of the space-view.
Panning translates this bounding box, and zooming scales it. When rendering, this bounding box is fit to the frame of the space view.
Double-clicking resets the bounding-box to the one set via code (if it exists) or a tight bounding box of the contents (if it doesn't).
So I propose we use a component SpaceView2DBounds { rect: datatypes.Rect }.