Class: DefaultCameraManager
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:44
Default implementation of CameraManager. Uses target-based orbit controls combined with keyboard and mouse navigation possibility. Supports automatic update of camera near and far planes and animated change of camera position and target.
Implements
Properties
automaticControlsSensitivity
automaticControlsSensitivity:
boolean
=true
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:110
When false, the sensitivity of the camera controls will not be updated automatically. This can be useful to better control the sensitivity of the 3D navigation.
When not set, control the sensitivity of the camera using viewer.cameraManager.cameraControls.minDistance
and viewer.cameraManager.cameraControls.maxDistance
.
automaticNearFarPlane
automaticNearFarPlane:
boolean
=true
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:102
When false, camera near and far planes will not be updated automatically (defaults to true). This can be useful when you have custom content in the 3D view and need to better control the view frustum.
When automatic camera near/far planes are disabled, you are responsible for setting this on your own.
Example
viewer.camera.near = 0.1;
viewer.camera.far = 1000.0;
viewer.camera.updateProjectionMatrix();
Accessors
keyboardNavigationEnabled
Get Signature
get keyboardNavigationEnabled():
boolean
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:196
Whether keyboard control of the camera is enabled/disabled.
Returns
boolean
Set Signature
set keyboardNavigationEnabled(
enabled
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:189
Sets whether keyboard control of the camera is enabled/disabled.
Parameters
enabled
boolean
Returns
void
Methods
activate()
activate(
cameraManager?
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:239
Set this manager as active and enable controls.
Should update CameraManager.enabled to reflect the state of the manager. Note that this is called automatically when a new CameraManager is set on the viewer.
Parameters
cameraManager?
Previously used camera manager.
Returns
void
Implementation of
deactivate()
deactivate():
void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:253
Deactivate this manager and disable controls.
Should update CameraManager.enabled to reflect the state of the manager. Note that this is called automatically when a new CameraManager is set on the viewer.
Returns
void
Implementation of
dispose()
dispose():
void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:291
Returns
void
Obvious
Implementation of
fitCameraToBoundingBox()
fitCameraToBoundingBox(
box
,duration?
,radiusFactor?
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:166
Moves camera to a place where the content of a bounding box is visible to the camera.
Parameters
box
Box3
duration?
number
The duration of the animation moving the camera.
radiusFactor?
number
= 2
The ratio of the distance from camera to center of box and radius of the box.
Returns
void
Implementation of
CameraManager
.fitCameraToBoundingBox
getCamera()
getCamera():
PerspectiveCamera
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:200
Returns the camera used for rendering the viewer.
Note that the camera will not be modified directly by Reveal.
Implementations must trigger the cameraChange
-event whenever the
camera changes.
Returns
PerspectiveCamera
Implementation of
getCameraControlsOptions()
getCameraControlsOptions():
CameraControlsOptions
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:264
Gets current camera controls options.
Returns
getCameraState()
getCameraState():
Required
<CameraState
>
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:231
Get camera's state
Returns
Required
<CameraState
>
Camera state: position, target and rotation.
Implementation of
getComboControlsOptions()
getComboControlsOptions():
Readonly
<ComboControlsOptions
>
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:174
Gets current Combo Controls options.
Returns
Readonly
<ComboControlsOptions
>
off()
off(
event
,callback
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:153
Unsubscribes from changes of the camera event.
Parameters
event
The event type.
"cameraChange"
| "cameraStop"
callback
Callback function to be unsubscribed.
Returns
void
Implementation of
on()
on(
event
,callback
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:140
Subscribes to events on this camera manager. There are several event types: 'cameraChange' - Subscribes to changes of the camera. This is used by Reveal to react on changes of the camera. 'cameraStop' - Subscribes to events indicating the camera has stopped
Parameters
event
The event type.
"cameraChange"
| "cameraStop"
callback
Callback to be called when the event is fired.
Returns
void
Implementation of
setCameraControlsOptions()
setCameraControlsOptions(
controlsOptions
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:272
Sets camera controls options to customize camera controls modes. See CameraControlsOptions.
Parameters
controlsOptions
JSON object with camera controls options.
Returns
void
setCameraState()
setCameraState(
state
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:210
Sets camera state. All parameters are optional. Rotation and target can't be set at the same time, if so, error will be thrown. Set rotation is preserved until next call of setCameraState with empty rotation field.
Parameters
state
Camera state. *
Returns
void
Implementation of
setComboControlsOptions()
setComboControlsOptions(
options
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:182
Sets Combo Controls options. Only provided options will be changed, any undefined options will be kept as is.
Parameters
options
Partial
<ComboControlsOptions
>
Returns
void
update()
update(
deltaTime
,boundingBox
):void
Defined in: packages/camera-manager/src/DefaultCameraManager.ts:282
Updates internal state of camera manager. Expected to update visual state of the camera
as well as it's near and far planes if needed. Called in requestAnimationFrame
-loop.
Reveal performance affects frequency with which this method is called.
Parameters
deltaTime
number
Delta time since last update in seconds.
boundingBox
Box3
Global bounding box of the model(s) and any custom objects added to the scene.
Returns
void