Handling Multitouch in the Canvas Widget
Posted: 22 May 2025 02:36
When a Canvas is set to multitouch, your scripts can receive input from multiple simultaneous touch points, each identified by a unique cursor ID. This makes it possible to implement advanced two-handed controls or gestures that track each finger independently. Canvas doesn't impose any specific gesture system — it's up to you to define the behavior you want.
The basic idea is to track the state of each active touch:
A new example project, MultitouchCanvas.jzml, demonstrating this approach is now available in the Example Lemur Projects GitHub repository. It shows a minimal working setup that tracks multiple touches and displays the number of active cursors.
https://github.com/MIDIKinetics/ExampleLemurProjects
The basic idea is to track the state of each active touch:
- On Cursor Down, record the cursor ID and its coordinates.
- On Cursor Move, update those coordinates.
- On Cursor Up, clear out the data associated with that cursor.
- * Active cursor IDs
- * Corresponding X and Y positions
A new example project, MultitouchCanvas.jzml, demonstrating this approach is now available in the Example Lemur Projects GitHub repository. It shows a minimal working setup that tracks multiple touches and displays the number of active cursors.
https://github.com/MIDIKinetics/ExampleLemurProjects