Created
July 24, 2012 08:57
-
-
Save borismus/3168940 to your computer and use it in GitHub Desktop.
A proposal for the pointer events specification. Started based on http://goo.gl/i32Q9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Interfaces | |
========== | |
Jargon... "Persistent points" will be mouse, pen tablets, and other pointing devices that | |
leave a "cursor" even when it's not being used. "Volatile points" are input points in the | |
context of surface based input devices, or others that do not leave a cursor when | |
inactive. (i.e. Wiimotes) Surface input devices may or may not have proximity support, | |
and the event firing model should be different based on that. | |
TODO: The names "persistent" and "volatile" sound pretty bad. Personally would like to change it. | |
interface Point { | |
readonly attribute unsigned long identifier; /* TODO: Set a range for each | |
input device? */ | |
readonly attribute EventTarget target; | |
readonly attribute bool isPersistent; /* If it is a persistent point | |
(i.e. mouse), true - if volatile | |
(touchscreen) false | |
(TODO: Is this really necessary? | |
It can be filtered out from the | |
point list..) */ | |
readonly attribute unsigned long screenX; | |
readonly attribute unsigned long screenY; | |
readonly attribute unsigned long clientX; | |
readonly attribute unsigned long clientY; | |
readonly attribute unsigned long pageX; | |
readonly attribute unsigned long pageY; | |
readonly attribute float force; /* Probably a deadweight.. */ | |
}; | |
interface PointList { | |
readonly attribute unsigned long length; | |
getter Point item (unsigned long index); | |
Point identifiedPoint (long identifier); | |
getter PointList getPersistentPoints(); /* Return all of the | |
persistent points in | |
the list */ | |
getter PointList getVolatilePoints(); /* Return all of the | |
volatile points in the | |
list */ | |
// TODO: Looping through this list to compare what points are different | |
// between two PointLists won't be fun. probably something to consider. | |
}; | |
interface PointEvent : UIEvent { | |
readonly attribute Point point; | |
readonly attribute boolean altKey; | |
readonly attribute boolean metaKey; | |
readonly attribute boolean ctrlKey; | |
readonly attribute boolean shiftKey; | |
readonly attribute EventTarget relatedTarget; | |
}; | |
partial interface Document { | |
readonly attribute PointList points; /* User agents should pre-populate | |
the list with existing persistent | |
points if possible */ | |
}; | |
Events | |
====== | |
pointover : For volatile points, this is immediately fired when the point is activated. | |
TODO: For proximity enabled surface input devices, this can probably be used | |
when the point is hovering the surface. | |
For persistent points, this is the equivalent of mouseover. | |
pointdown : For volatile points, this is immediately fired after pointover. | |
TODO: For proximity enabled surface input devices, this should be the fired | |
when the point has made contact to the surface. | |
For persistent points, this is the equivalent of mousedown. | |
pointup : For volatile points, this is fired when the point is de-activated. | |
TODO: For proximity enabled surface input devices, this should be the fired | |
when the point has lost contact to the surface. | |
For persistent points, this is the equivalent of mouseup. | |
pointmove : For volatile points, this is fired when the point is active and moved. | |
TODO: For proximity enabled surface input devices, this should fire as long | |
as the surface is able to capture the coordinate changes. | |
For persistent points, this is the equivalent of mousemove. | |
pointout : For volatile points, this is fired immediately after pointup. | |
TODO: For proximity enabled surface input devices, this should fire when the | |
surface can no longer track the point. | |
For persistent points, this is the equivalent of mouseout. | |
CSS Interoperability | |
==================== | |
Each pointover should trigger a hover. Ideally not in a exclusive way, as in allowing | |
multiple hovers in a declarative model. | |
Event Order and Interoperability | |
================================ | |
In touch events, it was this (for most implementations) for a single tap: | |
* touchstart -> touchend -> mouseover -> mousedown -> mouseup -> click | |
* pointover -> pointdown -> pointup -> mouseover -> mousedown -> mouseup -> click | |
For multiple points doing a single tap: | |
The numbers in the parentheses are identifiers to differentiate what the consequential | |
interop event (mouse) coordiantes will be mapped to. | |
* touchstart (1) -> touchstart (2) -> touchend (?) -> mouseover (2) | |
-> mousedown (2) -> mouseup (2) -> click (2) | |
* pointover (1) -> pointover (2) -> pointdown (1) -> pointdown (2) -> pointup (1) | |
-> pointout (1) -> pointup (2) -> pointout (2) -> mouseover (2) -> mousedown (2) | |
-> mouseup (2) -> click (2) | |
For a mouse moved from a non-listener into a listener, and clicked: | |
* pointmove -> mousemove -> pointover -> pointdown -> pointup -> mouseover | |
-> mousedown -> mouseup -> click | |
When it moves back to the non-listener: | |
* pointmove -> mousemove -> pointout -> mouseout -> pointmove -> mousemove |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment