Function setCameraLimits
-
setCameraLimits(
camera: ArcRotateCamera,
limits: ArcRotateCameraLimits,
scene?: SceneContext,
): () => voidParameters
- camera: ArcRotateCamera
- limits: ArcRotateCameraLimits
Optionalscene: SceneContext
Returns () => void
Optionalscene: SceneContext
Configure orbit/zoom limits on an ArcRotateCamera. This is fully opt-in and self-contained: cameras that never call it pay zero cost and bundle no clamping code (the camera's scalar setters call an undefined hook).
What it does:
_clampToLimits). The alpha/beta/radius setters invoke it on every mutation, so any caller — pinch direct-write, inertial overshoot, auto-rotate — is snapped back to the wall in the same statement that pushed past it. The camera is therefore never observably out of bounds at any point a per-frame callback reads it (e.g. a camera-pinned skybox), eliminating both the overshoot-then-snap jiggle and the one-frame clip "blink" of a deferred per-frame clamp.Only the fields present on
limitsare written, so calls compose; pass a field asundefinedto remove that bound. Returns a disposer that removes the self-clamp hook.The optional
sceneparameter is accepted for backward compatibility and is unused — enforcement no longer needs a per-frame scene hook.