Touch and gestures events

Hi all,

there seems to be some interest to standardize touch and gesture events.
They are becoming more common on OS level: Windows 7 has them, iPhone 
has them, OSX has at least gestures, X is getting support for them etc.

So perhaps there should be a new spec for touch and gesture events.
Hopefully a pretty simple spec.

It is not yet quite clear what the events should look like, but maybe 
something like this:

interface PointerEvent : UIEvent {
         readonly attribute long streamId;

         readonly attribute long screenX;
         readonly attribute long screenY;

         readonly attribute long clientX;
         readonly attribute long clientY;

         readonly attribute boolean ctrlKey;
         readonly attribute boolean shiftKey;
         readonly attribute boolean altKey;
         readonly attribute boolean metaKey;
         void initPointerEvent(...);
};

interface TouchEvent : PointerEvent {
         readonly attribute float pressure;
         readonly attribute long size;
         void initTouchEvent(...);
};
Touch Event types: touchdown, touchmove, touchup, touchover, touchout


interface GestureEvent : PointerEvent {
          // degrees
         readonly attribute float direction;
         readonly attribute float delta;
         void initGestureEvent(...);
};
Gesture Event types: gestureStart, gestureEnd, pan, rotate, zoom, swipe...


Touch Event handlers might want to know all the current touch positions, 
but even then, all the events should be dispatched, so that
events propagate properly also for example through (XBL2) anonymous 
content. Perhaps defaultView (window) could have a property which lists
current touches. (I don't like iPhone's touch events which contain all 
sort of list of touches.)

Gesture Events have the problem where to dispatch the events. Should
gestureStart be dispatched to the same node as gestureEnd? What if the 
node is removed, or moved to another document? User is still doing the 
gesture, so the event should be dispatched to somewhere. Where should 
other gesture events be dispatched? Whatever is "under the gesture"?

Any comments, ideas?

-Olli

Received on Wednesday, 17 June 2009 20:23:43 UTC