Class: KeyEvent
KeyEvent3D 按键事件。InputSystem
Hierarchy
↳
KeyEvent
Properties
- target
- currentTarget
- type
- data
- param
- time
- delay
- mouseCode
- ctrlKey
- altKey
- shiftKey
- targetTouches
- changedTouches
- touches
- KEY_DOWN
- KEY_UP
- keyCode
Constructors
Methods
Accessors
Properties
target
• target: Object3D
事件目标。 一般为注册事件的对象本身。
Inherited from
Defined in
currentTarget
• currentTarget: CEventListener
事件当前目标。 一般为注册事件的对象本身。
Inherited from
Defined in
type
• type: string
引擎中的事件的类型标识字符串
Inherited from
Defined in
data
• data: any
附加数据。 例如,保存QueueLoader加载后的原始数据,加载完毕后,作为参数传出。
Inherited from
Defined in
param
• param: any
注册事件时传递的参数
Inherited from
Defined in
time
• time: number
= 0
当前时间戳。
Inherited from
Defined in
delay
• delay: number
= 0
每帧间隔延时。
Inherited from
Defined in
mouseCode
• mouseCode: number
= 0
鼠标code值,枚举值可以参考MouseCode MouseCode
Inherited from
Defined in
ctrlKey
• ctrlKey: boolean
事件发生时 Ctrl 是否被按下
Inherited from
Defined in
altKey
• altKey: boolean
事件发生时 Alt 是否被按下
Inherited from
Defined in
shiftKey
• shiftKey: boolean
事件发生时 Shift 是否被按下
Inherited from
Defined in
targetTouches
• targetTouches: TouchData
[]
手指触摸到绑定事件的节点上的触摸点的集合 touch列表 TouchData
Inherited from
Defined in
changedTouches
• changedTouches: TouchData
[]
触摸事件时改变触摸点的集合 touch列表 TouchData
Inherited from
Defined in
touches
• touches: TouchData
[]
手指触摸到屏幕上引起的当前所有触摸点的集合 touch列表 TouchData
Inherited from
Defined in
KEY_DOWN
▪ Static
KEY_DOWN: string
= 'onKeyDown'
KEY_DOWN 常量定义 按键按下事件标识。 可注册对象 : Input类型。 事件响应状态 : 按键每次按下时响应。 响应事件参数 : KeyEvent3D类型,其中KeyEvent3D.keyCode的内容即为Key的值。
Default
"onKeyDown"
Platform
Web,Native
Defined in
src/engine/event/eventConst/KeyEvent.ts:29
KEY_UP
▪ Static
KEY_UP: string
= 'onKeyUp'
KEY_UP 常量定义 按键回弹事件标识。 可注册对象 : Input类型。 事件响应状态 : 按键每次回弹时响应。 响应事件参数 : KeyEvent3D类型,其中KeyEvent3D.keyCode的内容即为Key的值。
Default
"onKeyUp"
Platform
Web,Native
Defined in
src/engine/event/eventConst/KeyEvent.ts:40
keyCode
• keyCode: number
= 0
按键code值,枚举类型可以参考KeyCode KeyCode
Default
0
Platform
Web,Native
Defined in
src/engine/event/eventConst/KeyEvent.ts:48
Constructors
constructor
• new KeyEvent(eventType?
, data?
)
创建一个作为参数传递给事件侦听器的 Event对象。
Parameters
Name | Type | Default value | Description |
---|---|---|---|
eventType | string | null | {any} 事件类型 |
data | any | null | {any} 附加数据(可选) |
Inherited from
Defined in
src/engine/event/CEvent.ts:100
Methods
stopImmediatePropagation
▸ stopImmediatePropagation(): void
防止对事件流中当前节点的后续节点中的所有事件侦听器进行处理。
Returns
void
Inherited from
CEvent.stopImmediatePropagation
Defined in
src/engine/event/CEvent.ts:108
Accessors
isStopImmediatePropagation
• get
isStopImmediatePropagation(): boolean
(只读)是否调用过 stopImmediatePropagation() 方法.
Returns
boolean
Inherited from
CEvent.isStopImmediatePropagation