创建 ScreenSpaceElevatorCameraController 的实例。
| Name | Type | Description |
|---|---|---|
options |
ScreenSpaceElevatorCameraController.ControllerOptions | optional 配置控制器的选项。 |
Examples:
viewer.scene.screenSpaceCameraController.enableInputs = false;
viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
const elevatorCameraController = new Cesium.ScreenSpaceElevatorCameraController();
viewer.addController(elevatorCameraController);
// 配置控制器使用右鼠标按钮进行平移,而非默认的左鼠标按钮。
const elevatorCameraController = new Cesium.ScreenSpaceElevatorCameraController({
dragInputs: [{ button: Cesium.MouseButton.RIGHT}]
});
viewer.addController(elevatorCameraController);
Members
dragInputs : Array.<ScreenSpaceInputBindings.InputBinding>
控制垂直平移的拖拽输入绑定。每个绑定都是鼠标按钮与可选键盘修饰符的组合。
一个用于选择平移起点的世界位置的回调函数。该函数接受
Scene、屏幕空间位置 Cartesian2 和用于存储结果的 Cartesian3 实例作为参数。该函数应返回需要平移的世界位置 Cartesian3,如果无法选择位置则返回 undefined。如果返回 undefined,相机将相对于相机下方的椭球面进行平移。
决定控制器是否启用以及是否由宿主场景进行更新。
启用或禁用平移时的惯性。当启用时,用户停止拖拽后相机仍会继续移动,并根据
ScreenSpaceMapCameraController#inertialDecay 逐渐减速。
-
Default Value:
true
相机平移速度随时间衰减的速率。
-
Default Value:
6.0
一个位于
[0, 1) 范围内的参数,用于限制范围。
每个动画帧中,输入量占窗口宽度/高度的百分比。
这有助于在低帧率情况下控制相机位置。
-
Default Value:
0.1
相机平移的米每像素速度。
-
Default Value:
1.0
A callback function used to pick the world position from which to pan. The function is called with
Scene, the Cartesian2 screen space position, and a Cartesian3 instance to store the result. The function should return the Cartesian3 world position from which to pan, or undefined if no position could be picked. If undefined is returned, the camera will pan relative to the ellipsoid surface below the camera.
-
Default Value:
defaultPickWorldPosition
Example:
const elevatorCameraController = new Cesium.ScreenSpaceElevatorCameraController();
elevatorCameraController.pickWorldPosition = function (scene, windowPosition, result) {
// 从深度缓冲区选择世界位置
return scene.pickPosition(windowPosition, result);
};
viewer.addController(elevatorCameraController);
Methods
当控制器被添加到 DOM 时调用。需实现
connectedCallback 来设置任何 DOM 事件监听器。
| Name | Type | Description |
|---|---|---|
element |
HTMLElement | 包含 Cesium 场景的 DOM 元素。 |
当控制器从 DOM 中移除时调用。需实现
disconnectedCallback 来取消任何 DOM 事件监听器。
| Name | Type | Description |
|---|---|---|
element |
HTMLElement | 包含 Cesium 场景的 DOM 元素。 |
当控制器首次更新时调用,即在调用
update 之前。需实现 firstUpdate 以在相关场景开始渲染循环后执行一次性操作。例如初始化模拟时间值或将primitive添加到场景中。
| Name | Type | Description |
|---|---|---|
scene |
Scene | |
time |
JulianDate | 当前模拟时间。 |
See:
每帧调用一次。需实现
update 来修改相机或场景的其他部分。
| Name | Type | Description |
|---|---|---|
scene |
Scene | |
time |
JulianDate | 当前模拟时间。 |
Type Definitions
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
dragInputs |
Array.<ScreenSpaceInputBindings.InputBinding> |
<optional> |
控制平移的拖拽输入绑定。 |
