CameraController
The default camera controller extension that comes with the viewer package. Includes toggleable perspective and orthographic camera projections.
Properties
aspect
Gets the current display aspect ratio
Returns: number
controls
Gets the current underlying SpeckleControls implementation.
Returns: SpeckleControls
enabled
Gets or sets whether this extension is enabled.
Extensions typically need to support being turned on/off with no impact on potentially other active extensions.
Returns: boolean
fieldOfView
Gets or sets the perspective camera’s field of view.
Returns: number
options
Gets or sets the current camera controller options.
Returns: CameraControllerOptions
renderingCamera
Gets or sets the current rendering camera.
Returns: number
Methods
disableRotations
Disables all camera controls rotation capabilities.
Returns: void
enableRotations
Enables all camera controls rotation capabilities.
Returns: void
on
Function for subscribing to camera events.
Parameters
- eventType: CameraEvent
- listener: The handler for the events with CameraEventPayload arguments
Returns: void
removeListener
Function for un-subscribing from camera events.
Parameters
- e: CameraEvent
- handler: The handler for the events to unsubscribe
Returns: void
setCameraPlanes
Function that adapts the camera’s near and far clipping planes according to the current scene’s volume. Parameters
- targetVolume: Box3
- optional offsetScale: Works as a linear tolerance to the volume parameter
Returns: void
setCameraView
Focuses the camera based on the volume defined by the received object ids list.
Parameters
- objectIds: The object ids that make up the volume
- transition: Whether or not to make the transition animated
- optional fit: Linear tolerance
Focuses the camera based on explicit view models provided.
Parameters
- view: Explicit view of different possible type: CanonicalView, SpeckleView, InlineView
- transition: Whether or not to make the transition animated
- optional fit: Linear tolerance
Focuses the camera based on explicit volume provided as Box3.
Parameters
- bounds: Box3
- transition: Whether or not to make the transition animated
- optional fit: Linear tolerance
Returns: void
setOrthoCameraOn
Enables the orthographic camera.
Returns: void
setPerspectiveCameraOn
Enables the perspective camera.
Returns: void
toggleCameras
Switches between perspective and orthographic cameras.
Returns: void
Typedefs
CameraEvent
Events the camera controller puts out.
CameraEventPayload
Mapping CameraEvent types to handler argument type
CameraControllerOptions
The camera controller options. Defaults to
CameraProjection
Camera projection types.
CanonicalView
Supported cannonical views.
InlineView
Inline, on-demand camera view.
- position: The position of the camera
- target: The point in space where the camera looks at Returns: void
PolarView
Camera view defined in polar coordinates.