onTouchStart
This API is called using wx.onTouchStart(function listener).
Feature description:Listens for the start of a touch event.
Parameter and description: function listener. The function that handles the touch start event. Parameters are as follows:
|
touches | | List of all current touch points. |
changedTouches | | List of touch points that triggered this event. |
timeStamp | number | Timestamp when the event was triggered. |
onTouchMove
This API is called using wx.onTouchMove(function listener).
Feature description:Listens for touch move event.
Parameter and description: function listener. The function that handles the touch move event. Parameters are as follows:
|
touches | | List of all current touch points. |
changedTouches | | List of touch points that triggered this event. |
timeStamp | number | Timestamp when the event was triggered. |
onTouchEnd
This API is called using wx.onTouchEnd(function listener).
Feature description:Listens for the end of a touch event.
Parameter and description: function listener. The function that handles the touch end event. Parameters are as follows:
|
touches | | List of all current touch points. |
changedTouches | | List of touch points that triggered this event. |
timeStamp | number | Timestamp when the event was triggered. |
onTouchCancel
This API is called using wx.onTouchCancel(function listener).
Feature description:Listens for touch cancel event.
Parameter and description: function listener. The function that handles the touch cancel event. Parameters are as follows:
|
touches | | List of all current touch points. |
changedTouches | | List of touch points that triggered this event. |
timeStamp | number | Timestamp when the event was triggered. |
offTouchStart
This API is called using wx.offTouchStart(function listener).
Feature description:Removes the listener for the touch start event.
Parameter and description: function listener. The function that was passed to onTouchStart. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }
wx.onTouchStart(listener)
wx.offTouchStart(listener)
offTouchMove
This API is called using wx.offTouchMove(function listener).
Feature description:Removes the listener for the touch move event.
Parameter and description: function listener. The function that was passed to onTouchMove. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }
wx.onTouchMove(listener)
wx.offTouchMove(listener)
offTouchEnd
This API is called using wx.offTouchEnd(function listener).
Feature description: Removes the listener for the touch end event.
Parameter and description: function listener. The function that was passed to onTouchEnd. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }
wx.onTouchEnd(listener)
wx.offTouchEnd(listener)
offTouchCancel
This API is called using wx.offTouchCancel(function listener).
Feature description:Removes the listener for the touch cancel event.
Parameter and description: function listener. The function that was passed to onTouchCancel. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }
wx.onTouchCancel(listener)
wx.offTouchCancel(listener)
Touch
A touch point on a touch-sensitive device. It typically refers to a finger or stylus on a touchscreen or touchpad.
Property
number identifier
Unique identifier of a touch object, read-only. This identifier remains constant throughout the entire touch movement, allowing you to track whether it is the same touch point.
number pageX
The X-coordinate of the touch point relative to the left edge of the page.
number pageY
The Y-coordinate of the touch point relative to the top edge of the page.
number clientX
The X-coordinate of the touch point relative to the left edge of the visible viewport.
number clientY
The Y-coordinate of the touch point relative to the top edge of the visible viewport.
number force
The amount of pressure being applied to the touch surface, ranging from 0.0 (no pressure) to 1.0 (maximum pressure). This property is only available on devices that support force touch.