Luxar Viewer API Documentation - v2026.9.22
    Preparing search index...

    Coordinates the three camera control modes behind one stable interface.

    Owns the currently active control instance (orbit, fly, or ortho), swaps between them on request, and preserves camera position/orientation/target across each swap so switching modes never jumps the view. Also brokers the per-frame update tick (feeding delta time from an internal THREE.Timer), forwards change/start/end events from the active control, and persists scale-derived and auto-frame limits so they survive control recreation.

    Emits change (with the new controlType on a mode switch), start, and end. Most setters mutate the live control instance in place when its type matches, so config changes apply immediately without a mode switch.

    Hierarchy

    • EventDispatcher<ControlsManagerEventMap>
      • ControlsManager
    Index
    • Create controls manager for camera interaction.

      Parameters

      • camera: LuxarCamera

        Camera to control (perspective or orthographic)

      • domElement: HTMLElement

        DOM element for mouse/touch input (typically canvas)

      • Optional_scene: Scene<Object3DEventMap>

        Optional scene reference

      Returns ControlsManager

    camera: LuxarCamera
    domElement: HTMLElement
    currentControls: ActiveControls | null = null
    controlEvents: EventGroup = ...

    Cleanup group for the active controls' event forwarders and gesture interruption listener. Rebuilt on every switch so disposing the previous group detaches the old listeners atomically.

    currentType: ControlType = 'orbit'
    gestureActive: boolean = false

    Tracks whether a pointer gesture (drag, pinch, press-and-hold) is in progress on the active controls. Read by the AnimationController's idle check: a button or finger held still for longer than idleTimeoutMs must not pause the render loop, because the drag that follows feeds rotate/pan/zoom deltas into the controls that only update() — a per-frame call — ever applies.

    config: ControlsManagerConfig = ...
    sceneScale: number = 0
    storedDistanceLimits: { min: number; max: number } | null = null
    storedZoomLimits: { min: number; max: number } | null = null
    savedCameraPosition: Vector3 = ...
    savedCameraRotation: Euler = ...
    savedTarget: Vector3 = ...
    savedCameraUp: Vector3 = ...
    clock: Timer = ...
    • Update internal camera reference (e.g., when swapping between perspective and orthographic). Must be called BEFORE setControlType when the camera object itself changes.

      Parameters

      Returns void

    • Undo a LIVE dolly offset before the active controls are abandoned, so a transient mid-swing position is not baked into the saved camera state and carried into the next control instance.

      Only while the dolly is actually running. Once it has been switched off the camera's position is the user's chosen framing (see LuxarOrbitControls.autoDolly), and a mode switch must preserve it like any other.

      Returns void

    • Smallest camera-to-pivot distance the orbit system itself allows: the auto-frame min distance limit when one is set, capped at sceneScale·1e-3 (the scale-derived orbit floor). The fly-mode focus-target derivation floors the reused pivot depth here — auto-frame limits can legitimately put the orbit distance below sceneScale·1e-3 (fit distance / ZOOM_IN_FACTOR shrinks with wide FOVs), and a pivot depth the user could legally reach must survive a no-interaction mode round trip exactly.

      Returns number

    • Enable/disable the auto-dolly. Applies to the live instance so the change takes effect on the next frame without a mode switch.

      Parameters

      • enabled: boolean

      Returns void

    • Set the dolly amplitude from a user-facing PERCENT (15 → ±15% of the viewing distance). The control itself stores the fraction; this is one of the three seams that cross that boundary, and all of them go through dollyAmplitudeFromPercent.

      Parameters

      • percent: number

      Returns void

    • Set the dolly period in seconds (one full in-and-out oscillation).

      Parameters

      • seconds: number

      Returns void

    • Toggle the orbit-mode LEFT ↔ RIGHT mouse-button mapping. Updates stored config and, only when the active control is orbit (3D), mutates the live mouseButtons in place so the change applies immediately without a mode switch. Ortho and fly are intentionally ignored: ortho uses its own RIGHT=null mapping, fly doesn't use mouseButtons at all.

      Parameters

      • enabled: boolean

      Returns void

    • Whether auto-rotation can currently move the camera. Ortho carries the turntable settings for persistence, but disables rotation.

      Returns boolean

    • Whether the auto-dolly can currently move the camera. Gated on enableZoom rather than enableRotate: unlike the turntable, the dolly is alive in ortho mode, where it modulates camera.zoom. An inert amplitude or period counts as inactive so the render loop is not held awake by an oscillation of size zero.

      Returns boolean

    • Orbit wheel-zoom speed. zoomSpeed is read live per wheel event, so mutating the field applies immediately. Also affects ortho mode (same LuxarOrbitControls class) — one shared zoom feel across both.

      Parameters

      • speed: number

      Returns void

    • Orbit damping factor (camera "weight"). dampingFactor is read live per frame; applies immediately. Shared with ortho like the zoom speed.

      Parameters

      • factor: number

      Returns void

    • Set the orbit target without triggering an update. Use this when you also need to reinitialize() afterward (e.g., after auto-frame). For fly controls, instantly orients the camera toward the target.

      Parameters

      • target: Vector3

      Returns void

    • Re-derive internal orbit state (distance, orientation) from the current camera position and target. Must be called after externally setting camera.position to avoid the next update() snapping the camera back to the old distance.

      Returns void

    • Returns {
          inertialMode: boolean;
          damping: number;
          rotationDamping: number;
          movementSpeed: number;
          rotationSpeed: number;
      }

    • Set orbit distance limits (perspective camera zoom range). Called after auto-framing with the scene-fitting distance to give an asymmetric zoom range (ZOOM_IN_FACTOR in, ZOOM_OUT_FACTOR out). Persisted across mode switches so limits survive control recreation.

      Parameters

      • min: number
      • max: number

      Returns void

    • Set ortho zoom limits (orthographic camera zoom range). Called after auto-framing with the scene-fitting zoom to give an asymmetric zoom range (ZOOM_IN_FACTOR in, ZOOM_OUT_FACTOR out). Persisted across mode switches so limits survive control recreation.

      Parameters

      • min: number
      • max: number

      Returns void