Class Touch
Defined in: input.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Touch()
Creates an instance of the Touch object
|
Field Attributes | Field Name and Description |
---|---|
Canvas reference.
|
|
<static> |
Touch.points
Current touch points array.
|
<static> |
Touch.state
Current touch state.
|
<static> |
Touch.x
Current touch point X.
|
<static> |
Touch.y
Current touch point y.
|
Method Attributes | Method Name and Description |
---|---|
addCustomEvents(canvas, ontouchstart, ontouchmove, ontouchend)
Setup links to custom events outside the Touch object.
|
|
addEvents(canvas)
Setup links to events inside the Touch object.
|
|
Return Input device type.
|
|
getState()
Get the state of touch input, touchstart, touchmove or touchend.
|
|
getX()
Return x position of touch point.
|
|
getY()
Return y position of touch point.
|
|
ontouchend(e)
Touch end event
|
|
ontouchmove(e)
Touch move event
|
|
ontouchstart(e)
Touch start event
|
Field Detail
{[object HTMLCanvasElement]}
canvas
Canvas reference.
<static>
{Array}
Touch.points
Current touch points array.
<static>
{Number}
Touch.state
Current touch state.
<static>
{Number}
Touch.x
Current touch point X.
<static>
{Number}
Touch.y
Current touch point y.
Method Detail
addCustomEvents(canvas, ontouchstart, ontouchmove, ontouchend)
Setup links to custom events outside the Touch object.
- Parameters:
- {[object HTMLCanvasElement]} canvas
- Canvas object.
- {Object} ontouchstart
- Touch start event reference.
- {Object} ontouchmove
- Touch move event reference.
- {Object} ontouchend
- Touch end event reference.
addEvents(canvas)
Setup links to events inside the Touch object.
- Parameters:
- {[object HTMLCanvasElement]} canvas
- Canvas object.
{String}
getDeviceType()
Return Input device type.
- Returns:
- {String} Input device type.
{String}
getState()
Get the state of touch input, touchstart, touchmove or touchend.
- Returns:
- {String} Returns state string: touchstart, touchmove or touchend.
{Number}
getX()
Return x position of touch point.
- Returns:
- {Number} x touch point.
{Number}
getY()
Return y position of touch point.
- Returns:
- {Number} y touch point.
ontouchend(e)
Touch end event
- Parameters:
- {Event} e
- Touch end event.
ontouchmove(e)
Touch move event
- Parameters:
- {Event} e
- Touch move event.
ontouchstart(e)
Touch start event
- Parameters:
- {Event} e
- Touch start event.