Skip to content

Zoom

Deprecated

snaptrude.core.zoom is deprecated. Use core.camera.zoomExtents and core.camera.zoomSelection instead — the framing actions now live on the camera namespace alongside the rest of the viewport controls. These methods keep working (they delegate to the same implementation) but will be removed in a future release.

Camera zoom controls. Frame the viewport camera onto scene geometry — mirrors the canvas zoom menu ("Zoom extents" / "Zoom to selection"). Accessed via snaptrude.core.zoom.

Functions

extents()

Zoom (fit) the camera to all geometry in the scene — the "zoom extents" action. Deprecated — use core.camera.zoomExtents.

  • Returns: booleantrue once the camera has been framed to the scene.
ts
await snaptrude.core.zoom.extents();

selection()

Zoom (fit) the camera to the current selection. Deprecated — use core.camera.zoomSelection.

  • Returns: booleantrue if there was a selection to frame; false if nothing is selected (no-op).
ts
await snaptrude.core.zoom.selection();

Errors

Failed calls reject with a typed PluginError — see Error Handling. This namespace has no specific error conditions: both methods are total — selection() reports an empty selection as false, never an error.