处理用户输入事件。可以添加自定义函数以在用户输入时执行。 Handles user input events. Custom functions can be added to be executed on when the user enters input.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
element |
HTMLCanvasElement |
document
|
可选 optional 要添加事件的元素。 The element to add events to. |
成员 Members
接收到任何触摸事件后将禁用鼠标事件的时间量(以毫秒为单位),以便忽略任何模拟的鼠标事件。 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.
-
默认值: Default Value:
800
在屏幕上的触摸变成触摸并按住之前的时间量(以毫秒为单位)。 The amount of time, in milliseconds, before a touch on the screen becomes a touch and hold.
-
默认值: Default Value:
1500
方法 Methods
删除该对象持有的侦听器。 Removes listeners held by this object.
一旦对象被销毁,就不应再使用;调用除 Once an object is destroyed, it should not be used; calling any function other than
一旦对象被销毁,就不应再使用;调用除 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.
示例: Example:
handler = handler && handler.destroy();
另见: See:
getInputAction(type, modifier) → ScreenSpaceEventHandler.PositionedEventCallback|ScreenSpaceEventHandler.MotionEventCallback|ScreenSpaceEventHandler.WheelEventCallback|ScreenSpaceEventHandler.TwoPointEventCallback|ScreenSpaceEventHandler.TwoPointMotionEventCallback
返回要在输入事件上执行的函数。 Returns the function to be executed on an input event.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
type |
ScreenSpaceEventType | 输入事件的ScreenSpaceEventType。 The ScreenSpaceEventType of input event. |
modifier |
KeyboardEventModifier |
可选 optional
一个 KeyboardEventModifier 键,当 A KeyboardEventModifier key that is held when a type
事件发生。 event occurs. |
返回: Returns:
在输入事件上执行的函数。 The function to be executed on an input event.
如果该对象被销毁则返回 true;否则为假。 Returns true if this object was destroyed; otherwise, false.
如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than
如果该对象被破坏,则不应使用它;调用除 If this object was destroyed, it should not be used; calling any function other than
isDestroyed 将导致 will result in a DeveloperError exception.
返回: Returns:
true 如果该物体被摧毁;否则, if this object was destroyed; otherwise, false.
另见: See:
删除要在输入事件上执行的函数。 Removes the function to be executed on an input event.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
type |
ScreenSpaceEventType | 输入事件的ScreenSpaceEventType。 The ScreenSpaceEventType of input event. |
modifier |
KeyboardEventModifier |
可选 optional
一个 KeyboardEventModifier 键,当 A KeyboardEventModifier key that is held when a type
事件发生。 event occurs. |
设置要在输入事件上执行的函数。 Set a function to be executed on an input event.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
action |
ScreenSpaceEventHandler.PositionedEventCallback | ScreenSpaceEventHandler.MotionEventCallback | ScreenSpaceEventHandler.WheelEventCallback | ScreenSpaceEventHandler.TwoPointEventCallback | ScreenSpaceEventHandler.TwoPointMotionEventCallback | 当输入事件发生时执行的函数。 Function to be executed when the input event occurs. |
type |
ScreenSpaceEventType | 输入事件的ScreenSpaceEventType。 The ScreenSpaceEventType of input event. |
modifier |
KeyboardEventModifier |
可选 optional
一个 KeyboardEventModifier 键,当 A KeyboardEventModifier key that is held when a type
事件发生。 event occurs. |
类型定义 Type Definitions
从一个位置开始并在另一个位置结束的事件。 An Event that starts at one position and ends at another.
属性: Properties:
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
startPosition |
Cartesian2 | |
endPosition |
Cartesian2 |
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
event |
ScreenSpaceEventHandler.MotionEvent | 触发监听器的事件 The event which triggered the listener |
在屏幕上的单个位置发生的事件。 An Event that occurs at a single position on screen.
属性: Properties:
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
position |
Cartesian2 |
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
event |
ScreenSpaceEventHandler.PositionedEvent | 触发监听器的事件 The event which triggered the listener |
在屏幕上的两个位置发生的事件。 An Event that occurs at a two positions on screen.
属性: Properties:
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
position1 |
Cartesian2 | |
position2 |
Cartesian2 |
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
event |
ScreenSpaceEventHandler.TwoPointEvent | 触发监听器的事件 The event which triggered the listener |
从屏幕上的两个位置开始并移动到另外两个位置的事件。 An Event that starts at a two positions on screen and moves to two other positions.
属性: Properties:
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
position1 |
Cartesian2 | |
position2 |
Cartesian2 | |
previousPosition1 |
Cartesian2 | |
previousPosition2 |
Cartesian2 |
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
event |
ScreenSpaceEventHandler.TwoPointMotionEvent | 触发监听器的事件 The event which triggered the listener |
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
delta |
number | 鼠标滚轮移动的量 The amount that the mouse wheel moved |
