Skip to content

KBE3D / KBCore / Cesium / ScreenSpaceEventHandler

类: ScreenSpaceEventHandler

Handles user input events. Custom functions can be added to be executed on when the user enters input.

参数

The element to add events to.

属性

mouseEmulationIgnoreMilliseconds

static 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.


touchHoldDelayMilliseconds

static touchHoldDelayMilliseconds: number

The amount of time, in milliseconds, before a touch on the screen becomes a touch and hold.

方法

setInputAction()

setInputAction(action: PositionedEventCallback | MotionEventCallback | WheelEventCallback | TwoPointEventCallback | TwoPointMotionEventCallback, type: ScreenSpaceEventType, modifier?: KeyboardEventModifier): void

Set a function to be executed on an input event.

参数

action

Function to be executed when the input event occurs.

PositionedEventCallback | MotionEventCallback | WheelEventCallback | TwoPointEventCallback | TwoPointMotionEventCallback

type

ScreenSpaceEventType

The ScreenSpaceEventType of input event.

modifier?

KeyboardEventModifier

A KeyboardEventModifier key that is held when a <code>type</code> event occurs.

返回

void


getInputAction()

getInputAction(type: ScreenSpaceEventType, modifier?: KeyboardEventModifier): PositionedEventCallback | MotionEventCallback | WheelEventCallback | TwoPointEventCallback | TwoPointMotionEventCallback

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 <code>type</code> event occurs.

返回

PositionedEventCallback | MotionEventCallback | WheelEventCallback | TwoPointEventCallback | TwoPointMotionEventCallback

The function to be executed on an input event.


removeInputAction()

removeInputAction(type: ScreenSpaceEventType, modifier?: KeyboardEventModifier): void

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 <code>type</code> event occurs.

返回

void


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 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
handler = handler && handler.destroy();

构造函数

构造函数

new ScreenSpaceEventHandler(element?: HTMLCanvasElement): ScreenSpaceEventHandler

参数

element?

HTMLCanvasElement

返回

ScreenSpaceEventHandler

KBE3D @3.0.0 Copyright © 2024-present KBE3D