@tool YggdrasilCamera API
Camera controller for zooming and dragging a tree view viewport within bounds.
Signals
| Name |
|---|
| zoom_changed(zoom: float, previous_zoom: float) |
Properties
| Type | Name | Default |
|---|---|---|
| Control | _viewport | null |
| Rect2 | _bounds | Rect2() |
| float | _zoom | 1.0 |
| bool | _dragging | false |
| Vector2 | _last_mouse_pos | Vector2(0, 0) |
Methods
| Type | Name |
|---|---|
| void | set_viewport(viewport: Control) |
| void | set_bounds(bounds: Rect2) |
| void | input(event: InputEvent) |
| void | set_camera_zoom(zoom: float) |
Signal Descriptions
zoom_changed(zoom: float, previous_zoom: float)
Emitted when the camera zoom changes.
Property Descriptions
Control _viewport = null
Viewport control affected by camera movement and zoom.
Rect2 _bounds = Rect2()
Bounds used to clamp camera movement.
float _zoom = 1.0
Current camera zoom factor.
bool _dragging = false
Tracks whether middle mouse dragging is active.
Vector2 _last_mouse_pos = Vector2(0, 0)
Last recorded mouse position while dragging.
Method Descriptions
void set_viewport(viewport: Control)
Sets the viewport control, enables offset transforms on it, and connects resize handling.
void set_bounds(bounds: Rect2)
Sets the camera movement bounds.
void input(event: InputEvent)
Handles mouse wheel zooming and middle mouse dragging input for the camera.
void set_camera_zoom(zoom: float)
Sets the camera zoom, updates viewport transform scale and position, clamps the result, and emits
zoom_changed.