bevy_editor_prototypes
bevy_editor_prototypes copied to clipboard
Editor camera 2d zooming out beyond bounding box
trafficstars
Description
Currently, the 2D camera can zoom out indefinitely, even beyond the bounding box, which is not the desired behavior.
While camera panning is restricted when the zoom level is outside the bounding box (locking the camera position to the center of the bounding area) it would be better to prevent the camera from zooming out past the bounding box limits in the first place.
Expected Behavior
- The camera should not zoom out past the bounding box.
- Zooming should respect the size of the bounding box, limiting the zoom level such that the cameras viewport does not reach beyond the bounding box.
Current Behavior
- The camera can zoom out infinitely beyond the bounding box.
- Once the zoom level exceeds the bounding box, the camera’s panning functionality stops working, and the camera position becomes locked to the center of the bounding box.
Suggested Fix
To address this, it would be useful to:
- Implement a zoom limit that checks if the next viewport size after a zoom happened will fit inside the bounds. If it does not fit inside the bounding box then it should clamp the zoom to keep the viewport inside the bounding box.
- Ensure that panning continues to work when the zoom level is at it's limit, allowing smooth camera control within the allowed area. If the viewport is the same size as the bounding box then both zooming out and panning should not be possible.