Skip to main content
Version: Next

Interface: IFlexibleCameraManager

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:22

Beta

Flexible implementation of CameraManager. The user can switch between Orbit, FirstPerson or OrbitInCenter Supports automatic update of camera near and far planes and animated change of camera position and target. It provides additional functionality for controlling camera behavior and rotation.

Extends

Accessors

controlsType

Get Signature

get controlsType(): FlexibleControlsType

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:26

Beta

Get current FlexibleControlsType type

Returns

FlexibleControlsType

Set Signature

set controlsType(value): void

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:31

Beta

Set current FlexibleControlsType type

Parameters
value

FlexibleControlsType

Returns

void


options

Get Signature

get options(): FlexibleControlsOptions

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:37

Beta

Set the options for the camera manager

Returns

FlexibleControlsOptions

Methods

activate()

activate(cameraManager?): void

Defined in: packages/camera-manager/src/CameraManager.ts:61

Beta

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?

CameraManager

Previously used camera manager.

Returns

void

Inherited from

CameraManager.activate


addControlsTypeChangeListener()

addControlsTypeChangeListener(callback): void

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:52

Beta

Adds a listener for changes in the controls type of the camera manager.

Parameters

callback

FlexibleControlsTypeChangeDelegate

The callback function to be invoked when the controls type changes.

Returns

void


deactivate()

deactivate(): void

Defined in: packages/camera-manager/src/CameraManager.ts:69

Beta

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

Inherited from

CameraManager.deactivate


dispose()

dispose(): void

Defined in: packages/camera-manager/src/CameraManager.ts:109

Beta

Returns

void

Obvious

Inherited from

CameraManager.dispose


fitCameraToBoundingBox()

fitCameraToBoundingBox(boundingBox, duration?, radiusFactor?): void

Defined in: packages/camera-manager/src/CameraManager.ts:97

Beta

Moves camera to a place where the content of a bounding box is visible to the camera.

Parameters

boundingBox

Box3

The bounding box in world space.

duration?

number

The duration of the animation moving the camera.

radiusFactor?

number

The ratio of the distance from camera to center of box and radius of the box.

Returns

void

Inherited from

CameraManager.fitCameraToBoundingBox


getCamera()

getCamera(): PerspectiveCamera

Defined in: packages/camera-manager/src/CameraManager.ts:29

Beta

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

Inherited from

CameraManager.getCamera


getCameraState()

getCameraState(): Required<CameraState>

Defined in: packages/camera-manager/src/CameraManager.ts:52

Beta

Get camera's state

Returns

Required<CameraState>

Camera state: position, target and rotation.

Inherited from

CameraManager.getCameraState


off()

Call Signature

off(event, callback): void

Defined in: packages/camera-manager/src/CameraManager.ts:87

Beta

Unsubscribes from changes of the camera event.

Parameters
event

"cameraChange"

The event type.

callback

CameraChangeDelegate

Callback function to be unsubscribed.

Returns

void

Inherited from

CameraManager.off

Call Signature

off(event, callback): void

Defined in: packages/camera-manager/src/CameraManager.ts:88

Beta

Parameters
event

"cameraStop"

callback

CameraStopDelegate

Returns

void

Inherited from

CameraManager.off

Call Signature

off(event, callback): void

Defined in: packages/camera-manager/src/CameraManager.ts:89

Beta

Parameters
event

"cameraChange" | "cameraStop"

callback

CameraEventDelegate

Returns

void

Inherited from

CameraManager.off


on()

Call Signature

on(event, callback): void

Defined in: packages/camera-manager/src/CameraManager.ts:78

Beta

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

"cameraChange"

The event type.

callback

CameraChangeDelegate

Callback to be called when the event is fired.

Returns

void

Inherited from

CameraManager.on

Call Signature

on(event, callback): void

Defined in: packages/camera-manager/src/CameraManager.ts:79

Beta

Parameters
event

"cameraStop"

callback

CameraStopDelegate

Returns

void

Inherited from

CameraManager.on

Call Signature

on(event, callback): void

Defined in: packages/camera-manager/src/CameraManager.ts:80

Beta

Parameters
event

"cameraChange" | "cameraStop"

callback

CameraEventDelegate

Returns

void

Inherited from

CameraManager.on


onClick()

onClick(event): Promise<void>

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:64

Beta

Called when a click event is triggered

Parameters

event

PointerEvent

Returns

Promise<void>


onDoubleClick()

onDoubleClick(event): Promise<void>

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:70

Beta

Called when double click event is triggered

Parameters

event

PointerEvent

Returns

Promise<void>


onFocusChanged()

onFocusChanged(haveFocus): void

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:105

Beta

Called when focus is changed

Parameters

haveFocus

boolean

Returns

void


onKey()

onKey(event, down): void

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:99

Beta

Called when a key is pressed or released

Parameters

event

KeyboardEvent

down

boolean

Returns

void


onPointerDown()

onPointerDown(event, leftButton): Promise<void>

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:76

Beta

Called when pointer is pressed

Parameters

event

PointerEvent

leftButton

boolean

Returns

Promise<void>


onPointerDrag()

onPointerDrag(event, leftButton): Promise<void>

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:82

Beta

Called when pointer is dragged

Parameters

event

PointerEvent

leftButton

boolean

Returns

Promise<void>


onPointerUp()

onPointerUp(event, leftButton): Promise<void>

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:88

Beta

Called when pointer is released

Parameters

event

PointerEvent

leftButton

boolean

Returns

Promise<void>


onWheel()

onWheel(event, delta): Promise<void>

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:93

Beta

Called when wheel event is triggered

Parameters

event

WheelEvent

delta

number

Returns

Promise<void>


removeControlsTypeChangeListener()

removeControlsTypeChangeListener(callback): void

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:58

Beta

Removes a listener for changes in the controls type of the camera manager.

Parameters

callback

FlexibleControlsTypeChangeDelegate

The callback function to be removed from the controls type change listeners.

Returns

void


rotateCameraTo()

rotateCameraTo(direction, animationDuration): void

Defined in: packages/camera-manager/src/Flexible/IFlexibleCameraManager.ts:46

Beta

Rotates the camera to look in the specified direction. Supports automatic update of camera near and far planes and animated change of camera position and target.

Parameters

direction

Vector3

The direction to rotate the camera towards.

animationDuration

number

The duration of the rotation animation in milliseconds.

Returns

void


setCameraState()

setCameraState(state): void

Defined in: packages/camera-manager/src/CameraManager.ts:46

Beta

Set camera's state. Rotation and target can't be set at the same time as they could conflict, should throw an error if both are passed with non-zero value inside state.

Parameters

state

CameraState

Camera state, all fields are optional.

Returns

void

Example

// store position, target
const { position, target } = cameraManager.getCameraState();
// restore position, target
cameraManager.setCameraState({ position, target });

Inherited from

CameraManager.setCameraState


update()

update(deltaTime, boundingBox): void

Defined in: packages/camera-manager/src/CameraManager.ts:105

Beta

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

Inherited from

CameraManager.update