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:
Example:
handler = handler && handler.destroy();
See:
返回在输入事件上要执行的函数。
Name Type Description
type ScreenSpaceEventType 输入事件的 ScreenSpaceEventType。
modifiers Array.<KeyboardEventModifier> | KeyboardEventModifier optionaltype 事件发生时按住的 KeyboardEventModifier 键。
Returns:
在输入事件上要执行的函数。
See:
如果此对象已销毁则返回 true,否则返回 false。

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

removeInputAction(type, modifiers)

移除在输入事件上要执行的函数。
Name Type Description
type ScreenSpaceEventType 输入事件的 ScreenSpaceEventType。
modifiers Array.<KeyboardEventModifier> | KeyboardEventModifier optionaltype 事件发生时按住的 KeyboardEventModifier 键。
See:

setInputAction(action, type, modifiers)

设置在输入事件上要执行的函数。
Name Type Description
action ScreenSpaceEventHandler.PositionedEventCallback | ScreenSpaceEventHandler.MotionEventCallback | ScreenSpaceEventHandler.WheelEventCallback | ScreenSpaceEventHandler.TwoPointEventCallback | ScreenSpaceEventHandler.TwoPointMotionEventCallback 输入事件发生时执行的函数。
type ScreenSpaceEventType 输入事件的 ScreenSpaceEventType。
modifiers Array.<KeyboardEventModifier> | KeyboardEventModifier optionaltype 事件发生时按住的 KeyboardEventModifier 键。
See:

Type Definitions

Cesium.ScreenSpaceEventHandler.MotionEvent

一个从某个位置开始并在另一个位置结束的 Event。
Properties:
Name Type Description
startPosition Cartesian2
endPosition Cartesian2

Cesium.ScreenSpaceEventHandler.MotionEventCallback(event)

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

Cesium.ScreenSpaceEventHandler.PositionedEvent

一个在屏幕上单个位置发生的 Event。
Properties:
Name Type Description
position Cartesian2

Cesium.ScreenSpaceEventHandler.PositionedEventCallback(event)

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

Cesium.ScreenSpaceEventHandler.TwoPointEvent

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

Cesium.ScreenSpaceEventHandler.TwoPointEventCallback(event)

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

Cesium.ScreenSpaceEventHandler.TwoPointMotionEvent

一个从屏幕上两个位置开始并移动到另外两个位置的 Event。
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 论坛 上向社区和团队提问。.