ReadonlyglReadonlyorthographicReadonlyperspectiveCapture the currently displayed view as an image Blob (DD-030 D1). Renders the current scene +
active camera into an off-screen target at the requested size (so it never disturbs the live view
nor requires preserveDrawingBuffer), reads it back, and encodes it. Rejects with an
E_CAPTURE_UNSUPPORTED error when the renderer cannot render-to-target (a stub GL / no WebGL) or the
stage is disposed / context-lost. The caller owns the returned Blob — the library never downloads.
With no width/height and no pixelRatio set, the image is the resting drawing-buffer size, as
before (also mid-gesture). With a pixelRatio set it is the canvas's CSS size, so setting one never
changes it; pass width/height for a crisper image.
Fit a scene-space axis-aligned box to the viewport: the camera looks at the box center along
direction (target→camera; default the shared 3/4 pose) and backs off just far enough that every
corner lands inside BOTH the vertical and the horizontal field of view at the current aspect, with
margin (≥1, default 1.1) of slack. The orthographic frustum is sized to the same projected extent,
so a projection toggle keeps the apparent size. Unlike frameTo's bounding-sphere pose this
is tight: a wide/flat model fills a wide canvas instead of overflowing a narrow one.
Frame the camera to a scene-space center + radius via the shared 3/4 pose (stage.ts), sizing the ortho frustum and the zoom-distance clamps from the framed model so a projection toggle keeps the apparent size and the user can't dolly through/away from the model (#150/#267).
Read the current camera as a serializable CameraState (scene coords, #268).
OrbitControls 'change': render, and (when auto) adapt detail.
Switch camera projection (#150, DD-009 D3); the pose is copied so the view never jumps.
Restore a CameraState verbatim (#268) — no re-fit to the current model's bounds.
Change the perspective lens (DD-032) without a re-fit: the target stays and the camera distance is
scaled by framingLensScale(new)/framingLensScale(old), the same factor framing uses, so a framed view
after setFov(f) equals a fresh frame at f. It keeps the apparent size at ≤50°; above 50° it keeps the
frame margin instead (a pure tan dolly would put the camera inside the model). The zoom-distance limits
scale by the same factor, so the dolly is never clamped. In orthographic mode the view is untouched;
the value is kept and its dolly is applied on the next switch back to perspective. Programmatic: never
emits camera-changed. Throws RangeError for a fov outside [10, 120] — it never clamps.
Toggle interaction-aware quality (DD-020). 'off' restores full detail immediately.
Set the resting pixel ratio: a number in (0, 4], or 'device' (the display's DPR capped at 2, then
followed live as it changes). Goes through the interaction-quality controller, so a gesture in
progress keeps its reduction and its settle restores the new ratio. Throws RangeError otherwise
(never clamps). The default capture size stays the CSS size: pass width/height for a
larger image.
OrbitControls 'end': restore full detail after a debounce.
Snap to a preset orientation (#268): place the camera on the view's direction at the current distance.
The current view direction (orbit target → camera, unit).
The perspective camera's vertical field of view, degrees (default 50).