Event.EventTouch 类型
继承于 Event
模块: cc
触摸事件
索引
属性(properties)
- touch- Touch当前触点对象
- type- String事件类型。
- bubbles- Boolean表示该事件是否进行冒泡。
- target- Object最初事件触发的目标
- currentTarget- Object当前目标
- eventPhase- Number事件阶段
方法
- constructor
- getEventCode获取事件类型。
- getTouches获取触摸点的列表。
- setLocation设置当前触点位置
- getLocation获取触点位置。
- getLocationInView获取当前触点在游戏窗口中的位置。
- getPreviousLocation获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
- getStartLocation获获取触点落下时的位置对象,对象包含 x 和 y 属性。
- getID触点的标识 ID,可以用来在多点触摸中跟踪触点。
- getDelta获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
- getDeltaX获取触点距离上一次事件移动的 x 轴距离。
- getDeltaY获取触点距离上一次事件移动的 y 轴距离。
- getLocationX获取当前触点 X 轴位置。
- getLocationY获取当前触点 Y 轴位置。
- unuse重置对象池中存储的事件。
- reuse用于对象池再次使用的事件。
- stopPropagation停止传递当前事件。
- stopPropagationImmediate立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
- isStopped检查该事件是否已经停止传递.
- getCurrentTarget获取当前目标节点
- getType获取事件类型
Details
属性(properties)
touch
当前触点对象
| meta | description | 
|---|---|
| 类型 | Touch | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:336 | 
type
事件类型。
| meta | description | 
|---|---|
| 类型 | String | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:43 | 
bubbles
表示该事件是否进行冒泡。
| meta | description | 
|---|---|
| 类型 | Boolean | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:51 | 
target
最初事件触发的目标
| meta | description | 
|---|---|
| 类型 | Object | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:59 | 
currentTarget
当前目标
| meta | description | 
|---|---|
| 类型 | Object | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:67 | 
eventPhase
事件阶段
| meta | description | 
|---|---|
| 类型 | Number | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:75 | 
方法
constructor
| meta | description | 
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:327 | 
参数列表
- touchArrArray The array of the touches
- bubblesBoolean A boolean indicating whether the event bubbles up through the tree or not
getEventCode
获取事件类型。
| meta | description | 
|---|---|
| 返回 | Number | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:351 | 
getTouches
获取触摸点的列表。
| meta | description | 
|---|---|
| 返回 | Array | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:361 | 
setLocation
设置当前触点位置
| meta | description | 
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:379 | 
参数列表
getLocation
获取触点位置。
| meta | description | 
|---|---|
| 返回 | Vec2 | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:390 | 
getLocationInView
获取当前触点在游戏窗口中的位置。
| meta | description | 
|---|---|
| 返回 | Vec2 | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:400 | 
getPreviousLocation
获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
| meta | description | 
|---|---|
| 返回 | Vec2 | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:410 | 
getStartLocation
获获取触点落下时的位置对象,对象包含 x 和 y 属性。
| meta | description | 
|---|---|
| 返回 | Vec2 | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:420 | 
getID
触点的标识 ID,可以用来在多点触摸中跟踪触点。
| meta | description | 
|---|---|
| 返回 | Number | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:430 | 
getDelta
获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
| meta | description | 
|---|---|
| 返回 | Vec2 | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:440 | 
getDeltaX
获取触点距离上一次事件移动的 x 轴距离。
| meta | description | 
|---|---|
| 返回 | Number | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:450 | 
getDeltaY
获取触点距离上一次事件移动的 y 轴距离。
| meta | description | 
|---|---|
| 返回 | Number | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:460 | 
getLocationX
获取当前触点 X 轴位置。
| meta | description | 
|---|---|
| 返回 | Number | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:470 | 
getLocationY
获取当前触点 Y 轴位置。
| meta | description | 
|---|---|
| 返回 | Number | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event-manager/CCEvent.js:480 | 
unuse
重置对象池中存储的事件。
| meta | description | 
|---|---|
| 返回 | String | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:110 | 
reuse
用于对象池再次使用的事件。
| meta | description | 
|---|---|
| 返回 | String | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:125 | 
stopPropagation
停止传递当前事件。
| meta | description | 
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:136 | 
stopPropagationImmediate
立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
| meta | description | 
|---|---|
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:145 | 
isStopped
检查该事件是否已经停止传递.
| meta | description | 
|---|---|
| 返回 | Boolean | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:155 | 
getCurrentTarget
获取当前目标节点
| meta | description | 
|---|---|
| 返回 | Node | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:165 | 
getType
获取事件类型
| meta | description | 
|---|---|
| 返回 | String | 
| 定义于 | https:/github.com/cocos-creator/engine/blob/master/cocos2d/core/event/event.js:180 | 
