Skip to content

KBE3D / KBCore / Cesium / ScreenSpaceCameraController

类: ScreenSpaceCameraController

Modifies the camera position and orientation based on mouse input to a canvas.

参数

The scene.

属性

enableInputs

enableInputs: boolean

If true, inputs are allowed conditionally with the flags enableTranslate, enableZoom, enableRotate, enableTilt, and enableLook. If false, all inputs are disabled.

NOTE: This setting is for temporary use cases, such as camera flights and drag-selection of regions (see Picking demo). It is typically set to false at the start of such events, and set true on completion. To keep inputs disabled past the end of camera flights, you must use the other booleans (enableTranslate, enableZoom, enableRotate, enableTilt, and enableLook).


enableTranslate

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.


enableZoom

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.


enableRotate

enableRotate: boolean

If true, allows the user to rotate the world which translates the user's position. This flag only applies in 2D and 3D.


enableTilt

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.


enableLook

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.


inertiaSpin

inertiaSpin: number

A parameter in the range <code>[0, 1)</code> used to determine how long the camera will continue to spin because of inertia. With value of zero, the camera will have no inertia.


inertiaTranslate

inertiaTranslate: number

A parameter in the range <code>[0, 1)</code> used to determine how long the camera will continue to translate because of inertia. With value of zero, the camera will have no inertia.


inertiaZoom

inertiaZoom: number

A parameter in the range <code>[0, 1)</code> used to determine how long the camera will continue to zoom because of inertia. With value of zero, the camera will have no inertia.


maximumMovementRatio

maximumMovementRatio: number

A parameter in the range <code>[0, 1)</code> 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.


bounceAnimationTime

bounceAnimationTime: number

Sets the duration, in seconds, of the bounce back animations in 2D and Columbus view.


minimumZoomDistance

minimumZoomDistance: number

The minimum magnitude, in meters, of the camera position when zooming. Defaults to 1.0.


maximumZoomDistance

maximumZoomDistance: number

The maximum magnitude, in meters, of the camera position when zooming. Defaults to positive infinity.


zoomFactor

zoomFactor: number

A multiplier for the speed at which the camera will zoom.


translateEventTypes

translateEventTypes: any[] | CameraEventType | undefined

The input that allows the user to pan around the map. This only applies in 2D and Columbus view modes. <p> The type can be a CameraEventType, <code>undefined</code>, an object with <code>eventType</code> and <code>modifier</code> properties with types <code>CameraEventType</code> and KeyboardEventModifier, or an array of any of the preceding. </p>


zoomEventTypes

zoomEventTypes: any[] | CameraEventType | undefined

The input that allows the user to zoom in/out. <p> The type can be a CameraEventType, <code>undefined</code>, an object with <code>eventType</code> and <code>modifier</code> properties with types <code>CameraEventType</code> and KeyboardEventModifier, or an array of any of the preceding. </p>


rotateEventTypes

rotateEventTypes: any[] | CameraEventType | undefined

The input that allows the user to rotate around the globe or another object. This only applies in 3D and Columbus view modes. <p> The type can be a CameraEventType, <code>undefined</code>, an object with <code>eventType</code> and <code>modifier</code> properties with types <code>CameraEventType</code> and KeyboardEventModifier, or an array of any of the preceding. </p>


tiltEventTypes

tiltEventTypes: any[] | CameraEventType | undefined

The input that allows the user to tilt in 3D and Columbus view or twist in 2D. <p> The type can be a CameraEventType, <code>undefined</code>, an object with <code>eventType</code> and <code>modifier</code> properties with types <code>CameraEventType</code> and KeyboardEventModifier, or an array of any of the preceding. </p>


lookEventTypes

lookEventTypes: any[] | CameraEventType | undefined

The input that allows the user to change the direction the camera is viewing. This only applies in 3D and Columbus view modes. <p> The type can be a CameraEventType, <code>undefined</code>, an object with <code>eventType</code> and <code>modifier</code> properties with types <code>CameraEventType</code> and KeyboardEventModifier, or an array of any of the preceding. </p>


minimumPickingTerrainHeight

minimumPickingTerrainHeight: number

The minimum height the camera must be before picking the terrain or scene content instead of the ellipsoid. Defaults to scene.ellipsoid.minimumRadius * 0.025 when another ellipsoid than WGS84 is used.


minimumPickingTerrainDistanceWithInertia

minimumPickingTerrainDistanceWithInertia: number

The minimum distance the camera must be before testing for collision with terrain when zoom with inertia. Default to scene.ellipsoid.minimumRadius * 0.00063 when another ellipsoid than WGS84 is used.


minimumCollisionTerrainHeight

minimumCollisionTerrainHeight: number

The minimum height the camera must be before testing for collision with terrain. Default to scene.ellipsoid.minimumRadius * 0.0025 when another ellipsoid than WGS84 is used.


minimumTrackBallHeight

minimumTrackBallHeight: number

The minimum height the camera must be before switching from rotating a track ball to free look when clicks originate on the sky or in space. Defaults to ellipsoid.minimumRadius * 1.175 when another ellipsoid than WGS84 is used.


enableCollisionDetection

enableCollisionDetection: boolean

When disabled, the values of <code>maximumZoomDistance</code> and <code>minimumZoomDistance</code> are ignored. Also used in conjunction with Cesium3DTileset#enableCollision to prevent the camera from moving through or below a 3D Tileset surface. This may also affect clamping behavior when using HeightReference.CLAMP_TO_GROUND on 3D Tiles.


maximumTiltAngle

maximumTiltAngle: number | undefined

The angle, relative to the ellipsoid normal, restricting the maximum amount that the user can tilt the camera. If <code>undefined</code>, the angle of the camera tilt is unrestricted.

示例

ts
// Prevent the camera from tilting below the ellipsoid surface
viewer.scene.screenSpaceCameraController.maximumTiltAngle = Math.PI / 2.0;

方法

isDestroyed()

isDestroyed(): boolean

Returns true if this object was destroyed; otherwise, false. <br /><br /> If this object was destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception.

返回

boolean

true if this object was destroyed; otherwise, false.


destroy()

destroy(): void

Removes mouse listeners held by this object. <br /><br /> Once an object is destroyed, it should not be used; calling any function other than <code>isDestroyed</code> will result in a DeveloperError exception. Therefore, assign the return value (<code>undefined</code>) to the object as done in the example.

返回

void

示例

ts
controller = controller && controller.destroy();

构造函数

构造函数

new ScreenSpaceCameraController(scene: Scene): ScreenSpaceCameraController

参数

scene

Scene

返回

ScreenSpaceCameraController

KBE3D @3.0.0 Copyright © 2024-present KBE3D