Event.EventTouch 类型
继承于 Event
触摸事件
索引
属性(properties)
touchTouch当前触点对象typeString事件类型。bubblesBoolean表示该事件是否进行冒泡。targetObject最初事件触发的目标currentTargetObject当前目标eventPhaseNumber事件阶段
方法
constructorgetEventCode获取事件类型。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 |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:337 |
type
事件类型。
| meta | description |
|---|---|
| 类型 | String |
| 定义于 | cocos2d/core/event/event.js:44 |
bubbles
表示该事件是否进行冒泡。
| meta | description |
|---|---|
| 类型 | Boolean |
| 定义于 | cocos2d/core/event/event.js:52 |
target
最初事件触发的目标
| meta | description |
|---|---|
| 类型 | Object |
| 定义于 | cocos2d/core/event/event.js:60 |
currentTarget
当前目标
| meta | description |
|---|---|
| 类型 | Object |
| 定义于 | cocos2d/core/event/event.js:68 |
eventPhase
事件阶段
| meta | description |
|---|---|
| 类型 | Number |
| 定义于 | cocos2d/core/event/event.js:76 |
方法
constructor
| meta | description |
|---|---|
| 定义于 | cocos2d/core/event-manager/CCEvent.js:328 |
参数列表
touchArrArray The array of the touchesbubblesBoolean A boolean indicating whether the event bubbles up through the tree or not
getEventCode
获取事件类型。
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:352 |
getTouches
获取触摸点的列表。
| meta | description |
|---|---|
| 返回 | Array |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:362 |
setLocation
设置当前触点位置
| meta | description |
|---|---|
| 定义于 | cocos2d/core/event-manager/CCEvent.js:380 |
参数列表
getLocation
获取触点位置。
| meta | description |
|---|---|
| 返回 | Vec2 |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:391 |
getLocationInView
获取当前触点在游戏窗口中的位置。
| meta | description |
|---|---|
| 返回 | Vec2 |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:401 |
getPreviousLocation
获取触点在上一次事件时的位置对象,对象包含 x 和 y 属性。
| meta | description |
|---|---|
| 返回 | Vec2 |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:411 |
getStartLocation
获获取触点落下时的位置对象,对象包含 x 和 y 属性。
| meta | description |
|---|---|
| 返回 | Vec2 |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:421 |
getID
触点的标识 ID,可以用来在多点触摸中跟踪触点。
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:431 |
getDelta
获取触点距离上一次事件移动的距离对象,对象包含 x 和 y 属性。
| meta | description |
|---|---|
| 返回 | Vec2 |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:441 |
getDeltaX
获取触点距离上一次事件移动的 x 轴距离。
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:451 |
getDeltaY
获取触点距离上一次事件移动的 y 轴距离。
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:461 |
getLocationX
获取当前触点 X 轴位置。
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:471 |
getLocationY
获取当前触点 Y 轴位置。
| meta | description |
|---|---|
| 返回 | Number |
| 定义于 | cocos2d/core/event-manager/CCEvent.js:481 |
unuse
重置对象池中存储的事件。
| meta | description |
|---|---|
| 返回 | String |
| 定义于 | cocos2d/core/event/event.js:111 |
reuse
用于对象池再次使用的事件。
| meta | description |
|---|---|
| 返回 | String |
| 定义于 | cocos2d/core/event/event.js:126 |
stopPropagation
停止传递当前事件。
| meta | description |
|---|---|
| 定义于 | cocos2d/core/event/event.js:137 |
stopPropagationImmediate
立即停止当前事件的传递,事件甚至不会被分派到所连接的当前目标。
| meta | description |
|---|---|
| 定义于 | cocos2d/core/event/event.js:146 |
isStopped
检查该事件是否已经停止传递.
| meta | description |
|---|---|
| 返回 | Boolean |
| 定义于 | cocos2d/core/event/event.js:156 |
getCurrentTarget
获取当前目标节点
| meta | description |
|---|---|
| 返回 | Node |
| 定义于 | cocos2d/core/event/event.js:166 |
getType
获取事件类型
| meta | description |
|---|---|
| 返回 | String |
| 定义于 | cocos2d/core/event/event.js:181 |