import Touch from '@mobilizing/library/js/Mobilizing/input/Touch.js'
Touch
Extends:
Touch give an interface to access the multitouch events of the device. It holds a list of currently active touches and various ways to access their coordinates.
Constructor Summary
Public Constructor | ||
public | constructor(params: Object) |
Member Summary
Public Members | ||
public | Gives the number of touch currently active | |
public | ||
public | ||
public | ||
public | ||
public | pinchTouches: *[] | |
public | true if the active touch on screen > 1, false otherwise | |
public | ||
public | ||
public | ||
public | ||
public | swipeTime: * | |
public | ||
public | ||
public | target: * | |
public | ||
public | touchState: * | |
public | ||
public | touches: {} |
Private Members | ||
private | _time: * |
Method Summary
Public Methods | ||
public | get(index: Number:Int): TouchObject returns a TouchObject | |
public | Returns an object {x:Number, y:Number} that represents the coordinate of the touch delta, that is the numerical difference between the previous state in time and the actual one. | |
public | getDeltaX(index: Number:Int | Object:Touch): * Returns a Number that represents the coordinate of the touch delta, that is the numerical difference between the previous state in time and the actual one. | |
public | getDeltaY(index: Number:Int | Object:Touch): * Returns a Number that represents the coordinate of the touch delta, that is the numerical difference between the previous state in time and the actual one. | |
public | Returns an object {x:Number, y:Number} that represents the coordinate of the touch offset, that is the numerical difference between the start point of the touch and the actual one. | |
public | getOffsetX(index: Number:Int | Object:Touch): Number Returns a Number that represents the x coordinate of the touch offset, that is the numerical difference between the start point of the touch and the actual one. | |
public | getOffsetY(index: Number:Int | Object:Touch): Number Returns a Number that represents the y coordinate of the touch offset, that is the numerical difference between the start point of the touch and the actual one. | |
public | Returns a Number that represents the pinch touch move, that is the numerical difference between the start point of 2 touches and the actual one. | |
public | getX(index: Number:Int): Number:Int returns the x coordinate of the touch given as paramater | |
public | getY(index: Number:Int): Number:Int returns the y coordinate of the touch given as paramater | |
public | off() | |
public | on() | |
public | setup() Initialization method | |
public | update() |
Private Methods | ||
private | onTouchEnd(event: *) onTouchEnd listener | |
private | onTouchMove(event: *) onTouchMove listener | |
private | onTouchStart(event: *) onTouchStart listener Manage a new touch and organize it in the main touch list Input.touches |
Public Constructors
Public Members
public count: number source
Gives the number of touch currently active
Properties:
Name | Type | Attribute | Description |
count | Number |
public pinchTouches: *[] source
public pressed: boolean source
true if the active touch on screen > 1, false otherwise
Properties:
Name | Type | Attribute | Description |
pressed | Boolean |
public swipeCurrentTime: * source
public swipeStartTime: * source
public swipeTime: * source
public target: * source
public touchState: * source
public touches: {} source
Private Members
private _time: * source
Public Methods
public get(index: Number:Int): TouchObject source
returns a TouchObject
Params:
Name | Type | Attribute | Description |
index | Number:Int | the index of the touchObject to get |
Return:
TouchObject |
public getDelta(index: Number:Int | Object:Touch): Object source
Returns an object {x:Number, y:Number} that represents the coordinate of the touch delta, that is the numerical difference between the previous state in time and the actual one.
Params:
Name | Type | Attribute | Description |
index | Number:Int | Object:Touch | the index of the touch to get coordinates from, or the touch object |
Return:
Object | {x:Number, y:Number}, the x & y coordinates of the touch delta; |
public getDeltaX(index: Number:Int | Object:Touch): * source
Returns a Number that represents the coordinate of the touch delta, that is the numerical difference between the previous state in time and the actual one.
Params:
Name | Type | Attribute | Description |
index | Number:Int | Object:Touch | the index of the touch to get x coordinate from, or the touch object |
Return:
* | {Number:Int}, the x coordinates of the touch delta; |
public getDeltaY(index: Number:Int | Object:Touch): * source
Returns a Number that represents the coordinate of the touch delta, that is the numerical difference between the previous state in time and the actual one.
Params:
Name | Type | Attribute | Description |
index | Number:Int | Object:Touch | the index of the touch to get y coordinate from, or the touch object |
Return:
* | {Number:Int}, the y coordinates of the touch delta; |
public getOffset(index: Number:Int | Object:Touch): Object source
Returns an object {x:Number, y:Number} that represents the coordinate of the touch offset, that is the numerical difference between the start point of the touch and the actual one.
Params:
Name | Type | Attribute | Description |
index | Number:Int | Object:Touch | the index of the touch to get offset coordinate from, or the touch object |
Return:
Object | {x:Number, y:Number}, the x & y coordinates of the touch offset; |
public getOffsetX(index: Number:Int | Object:Touch): Number source
Returns a Number that represents the x coordinate of the touch offset, that is the numerical difference between the start point of the touch and the actual one.
Params:
Name | Type | Attribute | Description |
index | Number:Int | Object:Touch | the index of the touch to get x offset coordinate from, or the touch object |
Return:
Number | the x coordinates of the touch offset; |
public getOffsetY(index: Number:Int | Object:Touch): Number source
Returns a Number that represents the y coordinate of the touch offset, that is the numerical difference between the start point of the touch and the actual one.
Params:
Name | Type | Attribute | Description |
index | Number:Int | Object:Touch | the index of the touch to get y offset coordinate from, or the touch object |
Return:
Number | the y coordinates of the touch offset; |
public getPinch(): Number source
Returns a Number that represents the pinch touch move, that is the numerical difference between the start point of 2 touches and the actual one.
Return:
Number | the pinch delta value; |
public getX(index: Number:Int): Number:Int source
returns the x coordinate of the touch given as paramater
Params:
Name | Type | Attribute | Description |
index | Number:Int | the index of the touch to get x coordinate from |
Return:
Number:Int | x coordinate of the touch if active, -1 if not active |
public getY(index: Number:Int): Number:Int source
returns the y coordinate of the touch given as paramater
Params:
Name | Type | Attribute | Description |
index | Number:Int | the index of the touch to get y coordinate from |
Return:
Number:Int | y coordinate of the touch if active, -1 if not active |
public off() source
public on() source
public setup() source
Initialization method
public update() source
Private Methods
private onTouchEnd(event: *) source
onTouchEnd listener
Manage a touch removal and organize it in the main touch list Input.touches
Params:
Name | Type | Attribute | Description |
event | * |
private onTouchMove(event: *) source
onTouchMove listener
Manage a touch move and organize it in the main touch list Input.touches
Params:
Name | Type | Attribute | Description |
event | * |
private onTouchStart(event: *) source
onTouchStart listener Manage a new touch and organize it in the main touch list Input.touches
Params:
Name | Type | Attribute | Description |
event | * |