Skip to main content

Touch Down (touch.on)

Declaration

evt = touch.on(x, y)

Parameters

  • x, y
    Integers. Coordinates of the contact point in the current rotated coordinate system.

Returns

  • evt
    A touch event object used to control this touch process.

Notes

Simulates touching down at the specified position and returns a touch event object to operate this touch.
Note: A finger id is allocated and occupied automatically. The pool size is limited (about 30). If you exceed the limit and call touch.on or touch.tap again, a finger pool overflow error will be thrown. Avoid simultaneously occupying too many finger ids; release them promptly with :off.
You may also call with an explicit finger id (must be between 1 and 29), in which case you manage the id yourself:

touch.on(fingerId, x, y)

Example

-- Touch down at (100,100), move linearly to (200,200), then lift
touch.on(100, 100):move(200, 200):off()

-- Use explicit finger id 1
touch.on(1, 100, 100)
touch.off(1)