by andyclap » Sep 9, 2004 @ 8:46pm
The touchscreen on most (if not all) PPC devices is a simple 2-axis device, capable of returning where a single stylus is positioned.
However I've been thinking about multiple stylus (styli?? hmm I'll stick with styluses) recently for handling two finger typing on a software keyboard, and think it'd be perfectly possible to get a good estimation of two styluses' positions in code, providing you're not expecting them both to move at the same time, and assmung that two presses, even very close togther in time, will not be exactly concurrent. With current touchscreens, two simultenous points of contact on the touchscreen simply returns the midpoint between them.
Just thinking outloud here... We get a sort-of state machine:
Start in "no stylus" mode:
- mousedown, treat this as the first stylus mousedown, and enter "one stylus" mode
In "one stylus" mode:
- mouseup, treat this as the first stylus mouseup
- mousemove, check if the speed of the move (i.e. distance/time between messages) is greater than a threshold value. If it's not, it's a regular single stylus mousemove. If it is, treat this as the second stylus' mousedown. To get the position, add double the distance from the fist stylus' position, and enter "two styluses" mode
In "two styluses" mode:
- Mouseup, mouseup for both styluses
- Mousemove, those below the speed threshold are treated as the second stylus' mousemoves, again doubling the distance from the first stylus' position. If one above the threshold is received, whichever stylus position it is nearest is treated as the single remaining stylus, the other stylus does its mouseup processing, and we return to "one stylus" mode.
This could be quite an interesting technique, I can probably think of a few applications other than just two-finger typing. You could even extend it to more than two presses, although there'd probably be too much movement, and it might be a bit fiddly on such small screens.