new ScreenSpaceCameraController
Modifies the camera position and orientation based on mouse input to a canvas.
Parameters:
Name | Type | Description |
---|---|---|
canvas |
HTMLCanvasElement | The canvas to listen for events. |
cameraController |
CameraController | The camera controller used to modify the camera. |
Throws:
-
DeveloperError : canvas is required.
-
DeveloperError : cameraController is required.
Members
-
bounceAnimationTime :Number
-
Sets the duration, in milliseconds, of the bounce back animations in 2D and Columbus view. The default value is 3000.
- Default Value:
- 3000.0
-
columbusViewMode :CameraColumbusViewMode
-
Sets the behavior in Columbus view.
- Default Value:
-
enableLook :Boolean
-
If true, allows the user to use free-look. If false, the camera view direction can only be changed through translating or rotating. This flag only applies in 3D and Columbus view modes.
- Default Value:
- true
-
enableRotate :Boolean
-
If true, allows the user to rotate the camera. If false, the camera is locked to the current heading. This flag only applies in 2D and 3D.
- Default Value:
- true
-
enableTilt :Boolean
-
If true, allows the user to tilt the camera. If false, the camera is locked to the current heading. This flag only applies in 3D and Columbus view.
- Default Value:
- true
-
enableTranslate :Boolean
-
If true, allows the user to pan around the map. If false, the camera stays locked at the current position. This flag only applies in 2D and Columbus view modes.
- Default Value:
- true
-
enableZoom :Boolean
-
If true, allows the user to zoom in and out. If false, the camera is locked to the current distance from the ellipsoid.
- Default Value:
- true
-
inertiaSpin :Number
-
A parameter in the range
[0, 1)
used to determine how long the camera will continue to spin because of inertia. With value of zero, the camera will have no inertia.- Default Value:
- 0.9
-
inertiaTranslate :Number
-
A parameter in the range
[0, 1)
used to determine how long the camera will continue to translate because of inertia. With value of zero, the camera will have no inertia.- Default Value:
- 0.9
-
inertiaZoom :Number
-
A parameter in the range
[0, 1)
used to determine how long the camera will continue to zoom because of inertia. With value of zero, the camera will have no inertia.- Default Value:
- 0.8
-
lookEventTypes :CameraEventType|Array|undefined
-
The input that allows the user to change the direction the camera is viewing. This only applies in 3D and Columbus view modes.
The type came be a CameraEventType,
undefined
, an object witheventType
andmodifier
properties with typesCameraEventType
and KeyboardEventModifier, or an array of any of the preceding.- Default Value:
- { eventType : CameraEventType.LEFT_DRAG, modifier : KeyboardEventModifier.SHIFT }
-
maximumMovementRatio :Number
-
A parameter in the range
[0, 1)
used to limit the range of various user inputs to a percentage of the window width/height per animation frame. This helps keep the camera under control in low-frame-rate situations.- Default Value:
- 0.1
-
maximumZoomDistance :Number
-
The maximum magnitude, in meters, of the camera position when zooming. Defaults to positive infinity.
- Default Value:
- Number.POSITIVE_INFINITY
-
minimumZoomDistance :Number
-
The minimum magnitude, in meters, of the camera position when zooming. Defaults to 20.0.
- Default Value:
- 20.0
-
rotateEventTypes :CameraEventType|Array|undefined
-
The input that allows the user to rotate around the globe or another object. This only applies in 3D and Columbus view modes.
The type came be a CameraEventType,
undefined
, an object witheventType
andmodifier
properties with typesCameraEventType
and KeyboardEventModifier, or an array of any of the preceding.- Default Value:
-
tiltEventTypes :CameraEventType|Array|undefined
-
The input that allows the user to tilt in 3D and Columbus view or twist in 2D.
The type came be a CameraEventType,
undefined
, an object witheventType
andmodifier
properties with typesCameraEventType
and KeyboardEventModifier, or an array of any of the preceding.- Default Value:
- [CameraEventType.MIDDLE_DRAG, CameraEventType.PINCH, { eventType : CameraEventType.LEFT_DRAG, modifier : KeyboardEventModifier.CTRL }]
-
translateEventTypes :CameraEventType|Array|undefined
-
The input that allows the user to pan around the map. This only applies in 2D and Columbus view modes.
The type came be a CameraEventType,
undefined
, an object witheventType
andmodifier
properties with typesCameraEventType
and KeyboardEventModifier, or an array of any of the preceding.- Default Value:
-
zoomEventTypes :CameraEventType|Array|undefined
-
The input that allows the user to zoom in/out.
The type came be a CameraEventType,
undefined
, an object witheventType
andmodifier
properties with typesCameraEventType
and KeyboardEventModifier, or an array of any of the preceding.- Default Value:
Methods
-
destroy
-
Removes mouse listeners held by this object.
Once an object is destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception. Therefore, assign the return value (undefined
) to the object as done in the example.Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.Returns:
Example
controller = controller && controller.destroy();
-
isDestroyed
-
Returns true if this object was destroyed; otherwise, false.
If this object was destroyed, it should not be used; calling any function other thanisDestroyed
will result in a DeveloperError exception.Returns:
Booleantrue
if this object was destroyed; otherwise,false
. -
<static> prototype.getEllipsoid
-
Gets the ellipsoid. The ellipsoid is used to determine the size of the map in 2D and Columbus view as well as how fast to rotate the camera based on the distance to its surface.
Returns:
Ellipsoid The ellipsoid. -
<static> prototype.setEllipsoid
-
Sets the ellipsoid. The ellipsoid is used to determine the size of the map in 2D and Columbus view as well as how fast to rotate the camera based on the distance to its surface.
Parameters:
Name Type Argument Default Description ellipsoid
Ellipsoid <optional>
WGS84 The ellipsoid.