ScreenSpaceEventHandler

new Cesium.ScreenSpaceEventHandler(element)

Handles user input events. Custom functions can be added to be executed on when the user enters input.
参数名称 类型 默认值 描述信息
element HTMLCanvasElement document 可选 The element to add events to.

成员(属性)

static Cesium.ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds : number

The amount of time, in milliseconds, that mouse events will be disabled after receiving any touch events, such that any emulated mouse events will be ignored.
默认值: 800

static Cesium.ScreenSpaceEventHandler.touchHoldDelayMilliseconds : number

The amount of time, in milliseconds, before a touch on the screen becomes a touch and hold.
默认值: 1500

方法

Removes listeners held by this object.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed 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.
使用示例:
handler = handler && handler.destroy();
参考:
Returns the function to be executed on an input event.
参数名称 类型 描述信息
type ScreenSpaceEventType The ScreenSpaceEventType of input event.
modifier KeyboardEventModifier 可选 A KeyboardEventModifier key that is held when a type event occurs.
返回值:
The function to be executed on an input event.
参考:
Returns true if this object was destroyed; otherwise, false.

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
返回值:
true if this object was destroyed; otherwise, false.
参考:

removeInputAction(type, modifier)

Removes the function to be executed on an input event.
参数名称 类型 描述信息
type ScreenSpaceEventType The ScreenSpaceEventType of input event.
modifier KeyboardEventModifier 可选 A KeyboardEventModifier key that is held when a type event occurs.
参考:

setInputAction(action, type, modifier)

Set a function to be executed on an input event.
参数名称 类型 描述信息
action ScreenSpaceEventHandler.PositionedEventCallback | ScreenSpaceEventHandler.MotionEventCallback | ScreenSpaceEventHandler.WheelEventCallback | ScreenSpaceEventHandler.TwoPointEventCallback | ScreenSpaceEventHandler.TwoPointMotionEventCallback Function to be executed when the input event occurs.
type ScreenSpaceEventType The ScreenSpaceEventType of input event.
modifier KeyboardEventModifier 可选 A KeyboardEventModifier key that is held when a type event occurs.
参考:

定义的类型

Cesium.ScreenSpaceEventHandler.MotionEvent

An Event that starts at one position and ends at another.
属性:
属性名称 类型 描述信息
startPosition Cartesian2
endPosition Cartesian2

Cesium.ScreenSpaceEventHandler.MotionEventCallback(event)

参数名称 类型 描述信息
event ScreenSpaceEventHandler.MotionEvent The event which triggered the listener

Cesium.ScreenSpaceEventHandler.PositionedEvent

An Event that occurs at a single position on screen.
属性:
属性名称 类型 描述信息
position Cartesian2

Cesium.ScreenSpaceEventHandler.PositionedEventCallback(event)

参数名称 类型 描述信息
event ScreenSpaceEventHandler.PositionedEvent The event which triggered the listener

Cesium.ScreenSpaceEventHandler.TwoPointEvent

An Event that occurs at a two positions on screen.
属性:
属性名称 类型 描述信息
position1 Cartesian2
position2 Cartesian2

Cesium.ScreenSpaceEventHandler.TwoPointEventCallback(event)

参数名称 类型 描述信息
event ScreenSpaceEventHandler.TwoPointEvent The event which triggered the listener

Cesium.ScreenSpaceEventHandler.TwoPointMotionEvent

An Event that starts at a two positions on screen and moves to two other positions.
属性:
属性名称 类型 描述信息
position1 Cartesian2
position2 Cartesian2
previousPosition1 Cartesian2
previousPosition2 Cartesian2

Cesium.ScreenSpaceEventHandler.TwoPointMotionEventCallback(event)

参数名称 类型 描述信息
event ScreenSpaceEventHandler.TwoPointMotionEvent The event which triggered the listener

Cesium.ScreenSpaceEventHandler.WheelEventCallback(delta)

参数名称 类型 描述信息
delta number The amount that the mouse wheel moved