TouchData
Class | Type | Name | Interface Description |
---|---|---|---|
TouchData: AObject | Variables | phase: TouchPhase [ReadOnly] | Touch phase of the touch point |
position: Vector2f [ReadOnly] | Screen position of the touch point | ||
force: number [ReadOnly] | Force of the touch point | ||
touchId : number [ReadOnly] | The id value of the current touch data when multi-touch is required | ||
touchCount : number [ReadOnly] | The number of touch points when multi-touch is required | ||
TouchPhase | Enum | Began, | Touch starts, |
Moved, | Touch to move, | ||
Ended, | Touch ended, | ||
Canceled | Touch to Cancel |
Examples
phase: TouchPhase[ReadOnly]
const callback = (event:APJS.IEvent) => {
const touchInfo = event.args[0] as APJS.TouchData;
const outputTouchPhase = touchInfo.phase;
}
APJS.EventManager.getGlobalEmitter().on(APJS.EventType.Touch, callback)
position: Vector2f [ReadOnly]
const callback = (event:APJS.IEvent) => {
const touchInfo = event.args[0] as APJS.TouchData;
const outputTouchPosition = touchInfo.position;
}
APJS.EventManager.getGlobalEmitter().on(APJS.EventType.Touch, callback);
force: number [ReadOnly]
const callback = (event:APJS.IEvent) => {
const touchInfo = event.args[0] as APJS.TouchData;
const outputTouchForce = touchInfo.force;
}
APJS.EventManager.getGlobalEmitter().on(APJS.EventType.Touch, callback);
touchId : number [ReadOnly]
const callback = (event:APJS.IEvent) => {
const touchInfo = event.args[0] as APJS.TouchData;
const outputTouchId = touchInfo.touchId;
}
APJS.EventManager.getGlobalEmitter().on(APJS.EventType.Touch, callback);
touchCount : number [ReadOnly]
const callback = (event:APJS.IEvent) => {
const touchInfo = event.args[0] as APJS.TouchData;
const outputTouchCount = touchInfo.touchCount;
}
APJS.EventManager.getGlobalEmitter().on(APJS.EventType.Touch, callback);