Closed akaszynski closed 3 years ago
@akaszynski -- I'm (finally) getting around to looking at this. Are you ok with something like this getting merged?
Totally!
@akaszynski -- I'll flesh this out a bit (adding touch_standard_event_message_names
, looking for other places to make the touch interface similar to mouse and keyboard) unless you would prefer to do that. I'm fine either way, and have the time this week to wrap it up.
I hadn't really understood how touch events work until I started revising this. It turns out the location information is buried one level deeper than top-level touch event. The touch events have three lists attached, each of which consists of an individual touch point on the screen. Those individual touch points have essentially the same position attributes as a mouse event.
That means that using the position information from a touch event is a little more convoluted than using the position information from a mouse event. Getting clientX
, for example, when there is a single touch point on the screen means doing event['changedTouches'][0]['clientX']
which is a little convoluted.
Though this could maybe be simplified if there is only one touch point it seems better to mirror the format of the HTML TouchEvent
which contains three TouchList
s of individual Touch
points.
@akaszynski -- can you take a quick look at this when you get a chance?
Merging so that the new features can be released :)
@akaszynski -- this has been released in 0.9.0. I'm planning to release the first stable version, 2.0.0, tomorrow.
0.9.0 supports jlab 2 and 3. The stable release will support only jlab3 and higher.
Touch Events
This PR adds a basic interface to the following touch events:
'touchstart'
'touchend'
'touchmove'
'touchcancel'
It's not perfect;
_get_position
doesn't work as touch events don't appear to haveclient*
attributes, but they do havepage*
attributes that can be used instead to provide relative (x, y) coordinates.It actually works quite well, though ideally
mouse_standard_event_message_names
would have atouch
corollary (though, mouse events still work quite well).