import {CameraControl} from '@xeokit/xeokit-sdk/src/viewer/scene/CameraControl/CameraControl.js'
CameraControl
Extends:
Controls the Camera with user input, and fires events when the user interacts with pickable Entitys.
Contents
- Overview
- Examples
- Orbit Mode
- First-Person Mode
- Plan-View Mode
- CameraControl Events
- Custom Keyboard Mappings
Overview
- Each Viewer has a
CameraControl
, located at Viewer#cameraControl. - CameraControl#navMode selects the navigation mode:
"orbit"
rotates the Camera position about the target."firstPerson"
rotates the World about the Camera position."planView"
never rotates, but still allows to pan and dolly, typically for an axis-aligned view.
- CameraControl#followPointer makes the Camera follow the mouse or touch pointer.
- CameraControl#constrainVertical locks the Camera to its current height when in first-person mode.
CameraControl
fires pick events when we hover, click or tap on an Entity.
Examples
- Orbit Navigation - Duplex Model
- Orbit Navigation - Holter Tower Model
- First-Person Navigation - Duplex Model
- First-Person Navigation - Holter Tower Model
- Plan-view Navigation - Schependomlaan Model
- Custom Keyboard Mapping
Orbit Mode
In orbit mode, CameraControl
orbits the Camera about the target.
To enable orbit mode:
const cameraControl = myViewer.cameraControl;
cameraControl.navMode = "orbit";
Then orbit by:
- left-dragging the mouse,
- tap-dragging the touch pad, and
- pressing arrow keys, or
Q
andE
on a QWERTY keyboard, orA
andE
on an AZERTY keyboard.
Dolly forwards and backwards by:
- spinning the mouse wheel,
- pinching on the touch pad, and
- pressing the
+
and-
keys, orW
andS
on a QWERTY keyboard, orZ
andS
for AZERTY.
Pan horizontally and vertically by:
- right-dragging the mouse,
- left-dragging the mouse with the SHIFT key down,
- tap-dragging the touch pad with SHIFT down,
- pressing the
A
,D
,Z
andX
keys on a QWERTY keyboard, and - pressing the
Q
,D
,W
andX
keys on an AZERTY keyboard,
Following the Pointer in Orbit Mode
When CameraControl#followPointer is true
in orbiting mode, the mouse or touch pointer will dynamically
indicate the target that the Camera will orbit, as well as dolly to and from.
Lets ensure that we're in orbit mode, then enable the Camera to follow the pointer:
cameraControl.navMode = "orbit";
cameraControl.followPointer = true;
Smart Pivoting
TODO
Showing the Pivot Position
We can configure CameraControl#pivotElement with an HTML element to indicate the current
pivot position. The indicator will appear momentarily each time we move the Camera while in orbit mode with
CameraControl#followPointer set true
.
First we'll define some CSS to style our pivot indicator as a black dot with a white border:
.camera-pivot-marker {
color: #ffffff;
position: absolute;
width: 25px;
height: 25px;
border-radius: 15px;
border: 2px solid #ebebeb;
background: black;
visibility: hidden;
box-shadow: 5px 5px 15px 1px #000000;
z-index: 10000;
pointer-events: none;
}
Then we'll attach our pivot indicator's HTML element to the CameraControl
:
const pivotElement = document.createRange().createContextualFragment("<div class='camera-pivot-marker'></div>").firstChild;
document.body.appendChild(pivotElement);
cameraControl.pivotElement = pivotElement;
Axis-Aligned Views in Orbit Mode
In orbit mode, we can use keys 1-6 to position the Camera to look at the center of the Scene from along each of the six World-space axis. Pressing one of these keys will fly the Camera to the corresponding axis-aligned view.
View-Fitting Entitys in Orbit Mode
When CameraControl#doublePickFlyTo is true
, we can left-double-click or
double-tap (ie. "double-pick") an Entity to fit it to view. This will cause the Camera
to fly to that Entity. Our target then becomes the center of that Entity. If we are currently pivoting,
then our pivot position is then also set to the Entity center.
Disable that behaviour by setting CameraControl#doublePickFlyTo false
.
First-Person Mode
In first-person mode, CameraControl
rotates the World about the Camera position.
To enable first-person mode:
cameraControl.navMode = "firstPerson";
Then rotate by:
- left-dragging the mouse,
- tap-dragging the touch pad,
- pressing arrow keys, or
Q
andE
on a QWERTY keyboard, orA
andE
on an AZERTY keyboard.
Dolly forwards and backwards by:
- spinning the mouse wheel,
- pinching on the touch pad, and
- pressing the
+
and-
keys, orW
andS
on a QWERTY keyboard, orZ
andS
for AZERTY.
Pan left, right, up and down by:
- left-dragging or right-dragging the mouse, and
- tap-dragging the touch pad with SHIFT down.
Pan forwards, backwards, left, right, up and down by pressing the WSADZX
keys on a QWERTY keyboard,
or WSQDWX
keys on an AZERTY keyboard.
Following the Pointer in First-Person Mode
When CameraControl#followPointer is true
in first-person mode, the mouse or touch pointer will dynamically
indicate the target to which the Camera will dolly to and from. In first-person mode, however, the World will always rotate
about the Camera position.
Lets ensure that we're in first-person mode, then enable the Camera to follow the pointer:
cameraControl.navMode = "firstPerson";
cameraControl.followPointer = true;
When the pointer is over empty space, the target will remain the last object that the pointer was over.
Constraining Vertical Position in First-Person Mode
In first-person mode, we can lock the Camera to its current position on the vertical World axis, which is useful for walk-through navigation:
cameraControl.constrainVertical = true;
Axis-Aligned Views in First-Person Mode
In first-person mode we can use keys 1-6 to position the Camera to look at the center of the Scene from along each of the six World-space axis. Pressing one of these keys will fly the Camera to the corresponding axis-aligned view.
View-Fitting Entitys in First-Person Mode
As in orbit mode, when in first-person mode and CameraControl#doublePickFlyTo is true
, we can double-click
or double-tap an Entity (ie. "double-picking") to fit it in view. This will cause the Camera to fly to
that Entity. Our target then becomes the center of that Entity.
Disable that behaviour by setting CameraControl#doublePickFlyTo false
.
Plan-View Mode
In plan-view mode, CameraControl
pans and rotates the Camera, without rotating it.
To enable plan-view mode:
cameraControl.navMode = "planView";
Dolly forwards and backwards by:
- spinning the mouse wheel,
- pinching on the touch pad, and
- pressing the
+
and-
keys.
Pan left, right, up and down by:
- left-dragging or right-dragging the mouse, and
- tap-dragging the touch pad with SHIFT down.
Pan forwards, backwards, left, right, up and down by pressing the WSADZX
keys on a QWERTY keyboard,
or WSQDWX
keys on an AZERTY keyboard.
Following the Pointer in Plan-View Mode
When CameraControl#followPointer is true
in plan-view mode, the mouse or touch pointer will dynamically
indicate the target to which the Camera will dolly to and from. In plan-view mode, however, the Camera cannot rotate.
Lets ensure that we're in plan-view mode, then enable the Camera to follow the pointer:
cameraControl.navMode = "planView";
cameraControl.followPointer = true; // Default
When the pointer is over empty space, the target will remain the last object that the pointer was over.
Axis-Aligned Views in Plan-View Mode
As in orbit and first-person modes, in plan-view mode we can use keys 1-6 to position the Camera to look at the center of the Scene from along each of the six World-space axis. Pressing one of these keys will fly the Camera to the corresponding axis-aligned view.
CameraControl Events
CameraControl
fires events as we interact with Entitys using mouse or touch input.
The following examples demonstrate how to subscribe to those events.
The first example shows how to save a handle to a subscription, which we can later use to unsubscribe.
"hover"
Event fired when the pointer moves while hovering over an Entity.
const onHover = cameraControl.on("hover", (e) => {
const entity = e.entity; // Entity
const canvasPos = e.canvasPos; // 2D canvas position
});
To unsubscribe from the event:
cameraControl.off(onHover);
"hoverOff"
Event fired when the pointer moves while hovering over empty space.
cameraControl.on("hoverOff", (e) => {
const canvasPos = e.canvasPos;
});
"hoverEnter"
Event fired when the pointer moves onto an Entity.
cameraControl.on("hoverEnter", (e) => {
const entity = e.entity;
const canvasPos = e.canvasPos;
});
"hoverOut"
Event fired when the pointer moves off an Entity.
cameraControl.on("hoverOut", (e) => {
const entity = e.entity;
const canvasPos = e.canvasPos;
});
"picked"
Event fired when we left-click or tap on an Entity.
cameraControl.on("picked", (e) => {
const entity = e.entity;
const canvasPos = e.canvasPos;
});
"pickedSurface"
Event fired when we left-click or tap on the surface of an Entity.
cameraControl.on("picked", (e) => {
const entity = e.entity;
const canvasPos = e.canvasPos;
const worldPos = e.worldPos; // 3D World-space position
const viewPos = e.viewPos; // 3D View-space position
const worldNormal = e.worldNormal; // 3D World-space normal vector
});
"pickedNothing"
Event fired when we left-click or tap on empty space.
cameraControl.on("pickedNothing", (e) => {
const canvasPos = e.canvasPos;
});
"doublePicked"
Event fired wwhen we left-double-click or double-tap on an Entity.
cameraControl.on("doublePicked", (e) => {
const entity = e.entity;
const canvasPos = e.canvasPos;
});
"doublePickedSurface"
Event fired when we left-double-click or double-tap on the surface of an Entity.
cameraControl.on("doublePickedSurface", (e) => {
const entity = e.entity;
const canvasPos = e.canvasPos;
const worldPos = e.worldPos;
const viewPos = e.viewPos;
const worldNormal = e.worldNormal;
});
"doublePickedNothing"
Event fired when we left-double-click or double-tap on empty space.
cameraControl.on("doublePickedNothing", (e) => {
const canvasPos = e.canvasPos;
});
"rightClick"
Event fired when we right-click on the canvas.
cameraControl.on("rightClick", (e) => {
const event = e.event; // Mouse event
const canvasPos = e.canvasPos;
});
Custom Keyboard Mappings
We can customizeCameraControl
key bindings as shown below.
In this example, we'll just set the default bindings for a QWERTY keyboard.
const input = myViewer.scene.input;
cameraControl.navMode = "orbit";
cameraControl.followPointer = true;
const keyMap = {};
keyMap[cameraControl.PAN_LEFT] = [input.KEY_A];
keyMap[cameraControl.PAN_RIGHT] = [input.KEY_D];
keyMap[cameraControl.PAN_UP] = [input.KEY_Z];
keyMap[cameraControl.PAN_DOWN] = [input.KEY_X];
keyMap[cameraControl.DOLLY_FORWARDS] = [input.KEY_W, input.KEY_ADD];
keyMap[cameraControl.DOLLY_BACKWARDS] = [input.KEY_S, input.KEY_SUBTRACT];
keyMap[cameraControl.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
keyMap[cameraControl.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
keyMap[cameraControl.ROTATE_Y_POS] = [input.KEY_LEFT_ARROW];
keyMap[cameraControl.ROTATE_Y_NEG] = [input.KEY_RIGHT_ARROW];
keyMap[cameraControl.AXIS_VIEW_RIGHT] = [input.KEY_NUM_1];
keyMap[cameraControl.AXIS_VIEW_BACK] = [input.KEY_NUM_2];
keyMap[cameraControl.AXIS_VIEW_LEFT] = [input.KEY_NUM_3];
keyMap[cameraControl.AXIS_VIEW_FRONT] = [input.KEY_NUM_4];
keyMap[cameraControl.AXIS_VIEW_TOP] = [input.KEY_NUM_5];
keyMap[cameraControl.AXIS_VIEW_BOTTOM] = [input.KEY_NUM_6];
cameraControl.keyMap = keyMap;
We can also just configure default bindings for a specified keyboard layout, like this:
cameraControl.keyMap = "qwerty";
Then, CameraControl
will internally set CameraControl#keyMap to the default key map for the QWERTY
layout (which is the same set of mappings we set in the previous example). In other words, if we subsequently
read CameraControl#keyMap, it will now be a key map, instead of the "qwerty" string value we set it to.
Supported layouts are, so far:
"qwerty"
"azerty"
Member Summary
Public Members | ||
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public |
Identifies the XX action. |
|
public set |
Sets if this |
|
public get |
Gets if this |
|
public set |
constrainVertical(value: Boolean) Sets whether to vertically constrain the Camera position for first-person navigation. |
|
public get |
Gets whether to vertically constrain the Camera position for first-person navigation. |
|
public set |
dollyInertia(dollyInertia: Number) Sets the dolly inertia factor. |
|
public get |
dollyInertia: Number: * Gets the dolly inertia factor. |
|
public set |
dollyMinSpeed(dollyMinSpeed: Number) Sets the minimum dolly speed. |
|
public get |
dollyMinSpeed: Number: * Gets the minimum dolly speed. |
|
public set |
dollyProximityThreshold(dollyProximityThreshold: Number) Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases. |
|
public get |
Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases. |
|
public set |
dollyToPointer(value: Boolean) this set was deprecated.
|
|
public get |
this get was deprecated.
|
|
public set |
doubleClickTimeFrame(value: Number) Sets the double click time frame length in milliseconds. |
|
public get |
doubleClickTimeFrame(value: Number): * Gets the double click time frame length in milliseconds. |
|
public set |
doublePickFlyTo(value: Boolean) |
|
public get | ||
public set |
dragRotationRate(dragRotationRate: Number) Sets the current drag rotation rate. |
|
public get |
Gets the current drag rotation rate. |
|
public set |
firstPerson(value: Boolean) this set was deprecated.
Sets whether this |
|
public get |
firstPerson: Boolean: * this get was deprecated.
Gets whether this |
|
public set |
followPointer(value: Boolean) Sets whether the Camera follows the mouse/touch pointer. |
|
public get |
followPointer: Boolean: * Sets whether the Camera follows the mouse/touch pointer. |
|
public set |
Sets custom mappings of keys to |
|
public get |
Gets custom mappings of keys to CameraControl actions. |
|
public set |
keyboardDollyRate(keyboardDollyRate: Number) Sets how much the Camera dollys each second with keyboard input. |
|
public get |
Gets how much the Camera dollys each second with keyboard input. |
|
public set |
If |
|
public get |
Gets whether the keyboard shortcuts are enabled ONLY if the mouse is over the canvas or ALWAYS. |
|
public set |
keyboardLayout(value: String) this set was deprecated.
Sets the keyboard layout. |
|
public get |
keyboardLayout: String: * this get was deprecated.
Gets the keyboard layout. |
|
public set |
keyboardPanRate(keyboardPanRate: Number) Sets how much the Camera pans each second with keyboard input. |
|
public get |
Gets how much the Camera pans each second with keyboard input. |
|
public set |
keyboardRotationRate(keyboardRotationRate: Number) Sets how many degrees per second the Camera rotates/orbits with keyboard input. |
|
public get |
Sets how many degrees per second the Camera rotates/orbits with keyboard input. |
|
public set |
mouseWheelDollyRate(mouseWheelDollyRate: Number) Sets how much the Camera dollys each second while the mouse wheel is spinning. |
|
public get |
Gets how much the Camera dollys each second while the mouse wheel is spinning. |
|
public set |
Sets the current navigation mode. |
|
public get |
Gets the current navigation mode. |
|
public set |
panInertia(panInertia: Number) Sets the pan inertia factor. |
|
public get |
panInertia: Number: * Gets the pan inertia factor. |
|
public set |
panRightClick(value: Boolean) Sets whether either right-clicking (true) or middle-clicking (false) pans the Camera. |
|
public get |
panRightClick: Boolean: * Gets whether right-clicking pans the Camera. |
|
public set |
panToPointer(value: Boolean) this set was deprecated.
|
|
public get |
this get was deprecated.
|
|
public set |
pivotElement(element: HTMLElement) Sets the HTMl element to represent the pivot point when CameraControl#followPointer is true. |
|
public set |
Sets the current World-space 3D target position. |
|
public get |
Gets the current World-space 3D pivot position. |
|
public set |
this set was deprecated.
Sets whether this |
|
public get |
this get was deprecated.
Gets whether this |
|
public set |
pointerEnabled(value: Boolean) Sets whether mouse and touch input is enabled. |
|
public get |
Gets whether mouse and touch input is enabled. |
|
public set |
rotationInertia(rotationInertia: Number) Sets a factor in range |
|
public get |
Gets the rotation inertia factor. |
|
public set |
smartPivot(enabled: Boolean) Sets whether smart default pivoting is enabled. |
|
public get |
smartPivot: Boolean: * Gets whether smart default pivoting is enabled. |
|
public set |
snapRadius(snapRadius: Number) Sets the current snap radius for "hoverSnapOrSurface" events, to specify whether the radius within which the pointer snaps to the nearest vertex or the nearest edge. |
|
public get |
snapRadius: Number: * Gets the current snap radius. |
|
public set |
snapToEdge(snapToEdge: boolean) Sets whether the pointer snap to edge. |
|
public get |
snapToEdge: boolean: * Gets whether the pointer snap to edge. |
|
public set |
snapToVertex(snapToVertex: boolean) Sets whether the pointer snap to vertex. |
|
public get |
snapToVertex: boolean: * Gets whether the pointer snap to vertex. |
|
public set |
touchDollyRate(touchDollyRate: Number) Sets how much the Camera dollys with touch input. |
|
public get |
touchDollyRate: Number: * Gets how much the Camera dollys each second with touch input. |
|
public set |
touchPanRate(touchPanRate: Number) Sets how fast the camera pans on touch panning |
|
public get |
touchPanRate: Number: * Gets how fast the Camera pans on touch panning |
|
public set |
zoomOnMouseWheel(enabled: Boolean) Sets whether to zoom the camera on mouse wheel |
|
public get |
Gets whether to zoom the camera on mouse wheel |
Method Summary
Public Methods | ||
public |
Remove the sphere as the representation of the pivot position. |
|
public |
enablePivotSphere(cfg: Object) Sets a sphere as the representation of the pivot position. |
Inherited Summary
From class Component | ||
public get |
The Component that owns the lifecycle of this Component, if any. |
|
public |
True as soon as this Component has been destroyed |
|
public |
ID of this Component, unique within the Scene. |
|
public |
meta: * Arbitrary, user-defined metadata on this component. |
|
public |
The parent Scene that contains this Component. |
|
public |
The viewer that contains this Scene. |
|
public |
clear() Destroys all Components that are owned by this. |
|
public |
destroy() Destroys this component. |
|
public |
Logs an error for this component to the JavaScript console. |
|
public |
Fires an event on this component. |
|
public |
Returns true if there are any subscribers to the given event on this component. |
|
public |
Tests if this component is of the given type, or is a subclass of the given type. |
|
public |
Logs a console debugging message for this component. |
|
public |
Cancels an event subscription that was previously made with Component#on or Component#once. |
|
public |
Subscribes to an event on this component. |
|
public |
Subscribes to the next occurrence of the given event, then un-subscribes as soon as the event is subIdd. |
|
public |
scheduleTask(task: *) Schedule a task to perform on the next browser interval |
|
public |
Logs a warning for this component to the JavaScript console. |
Public Members
public set active(value: Boolean) source
Sets if this CameraControl
is active or not.
When inactive, the CameraControl
will not react to input.
Default is true
.
public get active: Boolean: * source
Gets if this CameraControl
is active or not.
When inactive, the CameraControl
will not react to input.
Default is true
.
public set constrainVertical(value: Boolean) source
Sets whether to vertically constrain the Camera position for first-person navigation.
When set true
, this constrains Camera#eye to its current vertical position.
Only applies when CameraControl#navMode is "firstPerson"
.
Default is false
.
public get constrainVertical: Boolean: * source
Gets whether to vertically constrain the Camera position for first-person navigation.
When set true
, this constrains Camera#eye to its current vertical position.
Only applies when CameraControl#navMode is "firstPerson"
.
Default is false
.
public set dollyInertia(dollyInertia: Number) source
Sets the dolly inertia factor.
This factor configures how much the Camera keeps moving after you finish dollying it.
This factor is a value in range [0..1]
. A value of 0.0
causes dollying to immediately stop,
0.5
causes dollying to decay 50% on each animation frame, while 1.0
causes no decay, which allows dollying
to continue until further input stops it.
You might set dollyInertia
to zero when you want be able to precisely position or rotate the Camera,
without interference from inertia. This also means that xeokit renders less frames while dollying the Camera,
which can improve rendering performance.
Default is 0
.
public set dollyMinSpeed(dollyMinSpeed: Number) source
Sets the minimum dolly speed.
Default is 0.04
.
public set dollyProximityThreshold(dollyProximityThreshold: Number) source
Sets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
Default is 35.0
.
public get dollyProximityThreshold: Number: * source
Gets the proximity to the closest object below which dolly speed decreases, and above which dolly speed increases.
Default is 35.0
.
public set doubleClickTimeFrame(value: Number) source
Sets the double click time frame length in milliseconds.
If two mouse click events occur within this time frame, it is considered a double click.
Default is 250
public get doubleClickTimeFrame(value: Number): * source
Gets the double click time frame length in milliseconds.
Default is 250
public set dragRotationRate(dragRotationRate: Number) source
Sets the current drag rotation rate.
This configures how many degrees the Camera rotates/orbits for a full sweep of the canvas by mouse or touch dragging.
For example, a value of 360.0
indicates that the Camera
rotates/orbits 360.0
degrees horizontally
when we sweep the entire width of the canvas.
CameraControl
makes vertical rotation half as sensitive as horizontal rotation, so that we don't tend to
flip upside-down. Therefore, a value of 360.0
rotates/orbits the Camera
through 180.0
degrees
vertically when we sweep the entire height of the canvas.
Default is 360.0
.
public get dragRotationRate: Number: * source
Gets the current drag rotation rate.
Default is 360.0
.
public set firstPerson(value: Boolean) source
Sets whether this CameraControl
is in first-person mode.
In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, Camera#eye rotates about Camera#look.
Default is false
.
Deprecated - use CameraControl#navMode instead.
public get firstPerson: Boolean: * source
Gets whether this CameraControl
is in first-person mode.
In "first person" mode (disabled by default) the look position rotates about the eye position. Otherwise, Camera#eye rotates about Camera#look.
Default is false
.
Deprecated - use CameraControl#navMode instead.
public set followPointer(value: Boolean) source
Sets whether the Camera follows the mouse/touch pointer.
In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
Default is true
.
See class comments for more info.
public get followPointer: Boolean: * source
Sets whether the Camera follows the mouse/touch pointer.
In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
In fly-to mode, the Camera will dolly to and from the pointer, however the World will always rotate about the Camera position.
In plan-view mode, the Camera will dolly to and from the pointer, however the Camera will not rotate.
Default is true
.
See class comments for more info.
public set keyMap(value: String) source
Sets custom mappings of keys to CameraControl
actions.
See class docs for usage.
public get keyMap: {Number: Number}: * source
Gets custom mappings of keys to CameraControl actions.
public set keyboardDollyRate(keyboardDollyRate: Number) source
Sets how much the Camera dollys each second with keyboard input.
Default is 15.0
, to dolly the Camera 15.0
World-space units per second while we hold down
the +
and -
keys.
public get keyboardDollyRate: Number: * source
Gets how much the Camera dollys each second with keyboard input.
Default is 15.0
.
public set keyboardEnabledOnlyIfMouseover(value: boolean) source
If true
, the keyboard shortcuts are enabled ONLY if the mouse is over the canvas.
public get keyboardEnabledOnlyIfMouseover: boolean: * source
Gets whether the keyboard shortcuts are enabled ONLY if the mouse is over the canvas or ALWAYS.
public set keyboardLayout(value: String) source
Sets the keyboard layout.
Supported layouts are:
"qwerty"
(default)"azerty"
public get keyboardLayout: String: * source
Gets the keyboard layout.
Supported layouts are:
"qwerty"
(default)"azerty"
public set keyboardPanRate(keyboardPanRate: Number) source
Sets how much the Camera pans each second with keyboard input.
Default is 5.0
, to pan the Camera 5.0
World-space units every second that
a panning key is depressed. See the CameraControl
class documentation for which keys control
panning.
Panning direction is aligned to our Camera's orientation. When we pan horizontally, we pan to our left and right, when we pan vertically, we pan upwards and downwards, and when we pan forwards and backwards, we pan along the direction the Camera is pointing.
Unlike dollying when followPointer is true
, panning does not follow the pointer.
public get keyboardPanRate: Number: * source
Gets how much the Camera pans each second with keyboard input.
Default is 5.0
.
public set keyboardRotationRate(keyboardRotationRate: Number) source
Sets how many degrees per second the Camera rotates/orbits with keyboard input.
Default is 90.0
, to rotate/orbit the Camera 90.0
degrees every second that
a rotation key is depressed. See the CameraControl
class documentation for which keys control
rotation/orbit.
public get keyboardRotationRate: Number: * source
Sets how many degrees per second the Camera rotates/orbits with keyboard input.
Default is 90.0
.
public set mouseWheelDollyRate(mouseWheelDollyRate: Number) source
Sets how much the Camera dollys each second while the mouse wheel is spinning.
Default is 100.0
, to dolly the Camera 10.0
World-space units per second as we spin
the mouse wheel.
public get mouseWheelDollyRate: Number: * source
Gets how much the Camera dollys each second while the mouse wheel is spinning.
Default is 100.0
.
public set navMode(navMode: String) source
Sets the current navigation mode.
Accepted values are:
- "orbit" - rotation orbits about the current target or pivot point,
- "firstPerson" - rotation is about the current eye position,
- "planView" - rotation is disabled.
See class comments for more info.
public set panInertia(panInertia: Number) source
Sets the pan inertia factor.
This factor configures how much the Camera keeps moving after you finish panning it.
This factor is a value in range [0..1]
. A value of 0.0
causes panning to immediately stop,
0.5
causes panning to decay 50% on each animation frame, while 1.0
causes no decay, which allows panning
to continue until further input stops it.
You might set panInertia
to zero when you want be able to precisely position or rotate the Camera,
without interference from inertia. This also means that xeokit renders less frames while panning the Camera,
wich can improve rendering performance.
Default is 0.5
.
public set panRightClick(value: Boolean) source
Sets whether either right-clicking (true) or middle-clicking (false) pans the Camera.
Default is true
.
public get panRightClick: Boolean: * source
Gets whether right-clicking pans the Camera.
Default is true
.
public set pivotElement(element: HTMLElement) source
Sets the HTMl element to represent the pivot point when CameraControl#followPointer is true.
See class comments for an example.
public set pivotPos(worldPos: Number[]) source
Sets the current World-space 3D target position.
Only applies when CameraControl#followPointer is true
.
public get pivotPos: Number[]: * source
Gets the current World-space 3D pivot position.
Only applies when CameraControl#followPointer is true
.
public set planView(value: Boolean) source
Sets whether this CameraControl
is in plan-view mode.
When in plan-view mode, rotation is disabled.
Default is false
.
Deprecated - use CameraControl#navMode instead.
public get planView: Boolean: * source
Gets whether this CameraControl
is in plan-view mode.
When in plan-view mode, rotation is disabled.
Default is false
.
Deprecated - use CameraControl#navMode instead.
public set pointerEnabled(value: Boolean) source
Sets whether mouse and touch input is enabled.
Default is true
.
Disabling mouse and touch input on CameraControl
is useful when we want to temporarily use mouse or
touch input to interact with some other 3D control, without disturbing the Camera.
public get pointerEnabled: Boolean: * source
Gets whether mouse and touch input is enabled.
Default is true
.
Disabling mouse and touch input on CameraControl
is desirable when we want to temporarily use mouse or
touch input to interact with some other 3D control, without interfering with the Camera.
public set rotationInertia(rotationInertia: Number) source
Sets a factor in range [0..1]
indicating how much the Camera keeps moving after you finish rotating it.
A value of 0.0
causes it to immediately stop, 0.5
causes its movement to decay 50% on each tick,
while 1.0
causes no decay, allowing it continue moving, by the current rate of rotation.
You may choose an inertia of zero when you want be able to precisely rotate the Camera, without interference from inertia. Zero inertia can also mean that less frames are rendered while you are rotating the Camera.
Default is 0.0
.
Does not apply when CameraControl#navMode is "planView"
, which disallows rotation.
public get rotationInertia: Number: * source
Gets the rotation inertia factor.
Default is 0.0
.
Does not apply when CameraControl#navMode is "planView"
, which disallows rotation.
public set smartPivot(enabled: Boolean) source
Sets whether smart default pivoting is enabled.
When true
, we'll pivot by default about the 3D position of the mouse/touch pointer on an
imaginary sphere that's centered at Camera#eye and sized to the Scene boundary.
When false
, we'll pivot by default about Camera#look.
Default is false
.
public get smartPivot: Boolean: * source
Gets whether smart default pivoting is enabled.
When true
, we'll pivot by default about the 3D position of the mouse/touch pointer on an
imaginary sphere that's centered at Camera#eye and sized to the Scene boundary.
When false
, we'll pivot by default about Camera#look.
Default is false
.
Return:
Boolean | Returns |
public set snapRadius(snapRadius: Number) source
Sets the current snap radius for "hoverSnapOrSurface" events, to specify whether the radius within which the pointer snaps to the nearest vertex or the nearest edge.
Default value is 30 pixels.
public set touchDollyRate(touchDollyRate: Number) source
Sets how much the Camera dollys with touch input.
Default is 0.2
public get touchDollyRate: Number: * source
Gets how much the Camera dollys each second with touch input.
Default is 0.2
.
public get touchPanRate: Number: * source
Gets how fast the Camera pans on touch panning
Default is 1.0
.