ScreenSpaceEventHandler

new Cesium.ScreenSpaceEventHandler(element)

处理用户输入事件。可以添加自定义函数,在用户输入时执行。
Name Type Default Description
element HTMLCanvasElement document optional 要添加事件的元素。

Members

static Cesium.ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds : number

接收到触摸事件后,将禁用鼠标事件的时间,单位为毫秒,以便忽略任何模拟的鼠标事件。
Default Value: 800

static Cesium.ScreenSpaceEventHandler.touchHoldDelayMilliseconds : number

在屏幕上触摸后,经过多长时间变为触摸并保持的时间,单位为毫秒。
Default Value: 1500

Methods

移除此对象持有的监听器。

一旦对象被销毁,就不应使用;调用除 isDestroyed 以外的任何函数将导致 DeveloperError 异常。 因此, 应将返回值(undefined)分配给该对象,如示例所示。
Throws:
  • DeveloperError : 此对象已被销毁,即,已调用 destroy()。
Example:
handler = handler && handler.destroy();
See:
返回在输入事件上执行的函数。
Name Type Description
type ScreenSpaceEventType 输入事件的 ScreenSpaceEventType。
modifier KeyboardEventModifier optional 在发生 type 事件时按下的 KeyboardEventModifier 键。
Returns:
在输入事件上执行的函数。
See:
如果此对象已被销毁,则返回 true;否则返回 false。

如果此对象已被销毁,则不应使用;调用除 isDestroyed 以外的任何函数将导致 DeveloperError 异常。
Returns:
如果此对象已被销毁,则返回 true;否则返回 false
See:

removeInputAction(type, modifier)

移除在输入事件上执行的函数。
Name Type Description
type ScreenSpaceEventType 输入事件的 ScreenSpaceEventType。
modifier KeyboardEventModifier optional 在发生 type 事件时按下的 KeyboardEventModifier 键。
See:

setInputAction(action, type, modifier)

设置在输入事件发生时执行的函数。
Name Type Description
action ScreenSpaceEventHandler.PositionedEventCallback | ScreenSpaceEventHandler.MotionEventCallback | ScreenSpaceEventHandler.WheelEventCallback | ScreenSpaceEventHandler.TwoPointEventCallback | ScreenSpaceEventHandler.TwoPointMotionEventCallback 输入事件发生时要执行的函数。
type ScreenSpaceEventType 输入事件的 ScreenSpaceEventType。
modifier KeyboardEventModifier optional 在发生 type 事件时按下的 KeyboardEventModifier 键。
See:

Type Definitions

Cesium.ScreenSpaceEventHandler.MotionEvent

从一个位置开始并结束于另一个位置的事件。
Properties:
Name Type Description
startPosition Cartesian2
endPosition Cartesian2

Cesium.ScreenSpaceEventHandler.MotionEventCallback(event)

Name Type Description
event ScreenSpaceEventHandler.MotionEvent 触发监听器的事件

Cesium.ScreenSpaceEventHandler.PositionedEvent

在屏幕上某个位置发生的事件。
Properties:
Name Type Description
position Cartesian2

Cesium.ScreenSpaceEventHandler.PositionedEventCallback(event)

Name Type Description
event ScreenSpaceEventHandler.PositionedEvent 触发监听器的事件

Cesium.ScreenSpaceEventHandler.TwoPointEvent

在屏幕上两个位置发生的事件。
Properties:
Name Type Description
position1 Cartesian2
position2 Cartesian2

Cesium.ScreenSpaceEventHandler.TwoPointEventCallback(event)

Name Type Description
event ScreenSpaceEventHandler.TwoPointEvent 触发监听器的事件

Cesium.ScreenSpaceEventHandler.TwoPointMotionEvent

在屏幕上从两个位置开始并移动到两个其他位置的事件。
Properties:
Name Type Description
position1 Cartesian2
position2 Cartesian2
previousPosition1 Cartesian2
previousPosition2 Cartesian2

Cesium.ScreenSpaceEventHandler.TwoPointMotionEventCallback(event)

Name Type Description
event ScreenSpaceEventHandler.TwoPointMotionEvent 触发监听器的事件

Cesium.ScreenSpaceEventHandler.WheelEventCallback(delta)

Name Type Description
delta number 鼠标滚轮移动的距离
需要帮助?获得答案的最快方法是来自社区和团队 Cesium Forum.