Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: sky/specs/pointer.md

Issue 892633004: Specs: Define when pointer events fire; stub for keyboard events (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/specs/keyboard.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 UI Events 1 Pointer Events
2 ========= 2 ==============
3 3
4 Scope 4 Scope
5 ----- 5 -----
6 6
7 The following input devices are supported by sky: 7 The following input devices are supported by sky:
8 - fingers on multitouch screens 8 - fingers on multitouch screens
9 - mice, including mouse wheels 9 - mice, including mouse wheels
10 - styluses on screens 10 - styluses on screens
11 - other devices that emulate mice (track pads, track balls) 11 - other devices that emulate mice (track pads, track balls)
12 - keyboards 12 - [Keyboard](keyboard.md)
13 13
14 The following input devices are not supported natively by sky, but can 14 The following input devices are not supported natively by sky, but can
15 be used by connecting directly to the mojo application servicing the 15 be used by connecting directly to the mojo application servicing the
16 relevant device: 16 relevant device:
17 - joysticks 17 - joysticks
18 - track balls that move focus (or raw data from track balls) 18 - track balls that move focus (or raw data from track balls)
19 - raw data from track pads (e.g. multitouch gestures) 19 - raw data from track pads (e.g. multitouch gestures)
20 - raw data from styluses that have their own absolute pads 20 - raw data from styluses that have their own absolute pads
21 - raw data from mice (e.g. to handle mouse capture in 3D games) 21 - raw data from mice (e.g. to handle mouse capture in 3D games)
22 22
(...skipping 17 matching lines...) Expand all
40 - a zoom/rotation (whether using two finger gestures, or one finger 40 - a zoom/rotation (whether using two finger gestures, or one finger
41 with the double-tap-and-hold gesture) 41 with the double-tap-and-hold gesture)
42 - a double-tap autozoom 42 - a double-tap autozoom
43 43
44 In particular, this means distinguishing whether a finger tap consists 44 In particular, this means distinguishing whether a finger tap consists
45 of a tap, a drag, or a long-press; it also means distinguishing 45 of a tap, a drag, or a long-press; it also means distinguishing
46 whether a drag, once established as such, should be treated as a pan 46 whether a drag, once established as such, should be treated as a pan
47 or a drag, and deciding whether a secondary touch should begin a 47 or a drag, and deciding whether a secondary touch should begin a
48 zoom/rotation or not. 48 zoom/rotation or not.
49 49
50 This is done using the [gesture recogniser API](gestures.md)
50 51
51 Pointer events 52
52 -------------- 53 Pointers
54 --------
53 55
54 Each touch or pointer is tracked individually. 56 Each touch or pointer is tracked individually.
55 57
56 New touches and pointers can appear and disappear over time. 58 New touches and pointers can appear and disappear over time.
57 59
58 Each pointer has a list of current targets. 60 Each pointer has a list of current targets.
59 61
60 When a new one enters the system, a non-bubbling 'pointer-added' event 62 When a new one enters the system, a non-bubbling 'pointer-added' event
61 is fired at the application's document, and the pointer's current 63 is fired at the application's document, and the pointer's current
62 targets list is initialised to just that Document object. 64 targets list is initialised to just that Document object.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 that only contains the application's document. 141 that only contains the application's document.
140 142
141 Nothing special happens when a pointer's current target moves in the 143 Nothing special happens when a pointer's current target moves in the
142 DOM. 144 DOM.
143 145
144 The x and y position of an -up or -down event always match those of 146 The x and y position of an -up or -down event always match those of
145 the previous -moved or -added event, so their dx and dy are always 0. 147 the previous -moved or -added event, so their dx and dy are always 0.
146 148
147 Positions are floating point numbers; they can have subpixel values. 149 Positions are floating point numbers; they can have subpixel values.
148 150
151 For each pointer, only a single pointer-added or pointer-removed event
152 is fired per frame. If a pointer would have been added and removed in
153 the same frame, the pointer is ignored, and no events are fired for
154 that pointer.
155
156 For each pointer, only a single pointer-down or pointer-up event is
157 fired per frame, representing the change in state from the last frame,
158 if any. Exactly when the event is fired is up to the implementation
159 and may depend on the hardware.
160
161 For each pointer, at most two pointer-move events are fired per frame,
162 one before the pointer-down or pointer-up event, if any, and one
163 after. If the pointer didn't change "down" state, then only one
164 pointer-move event is fired. All the actual moves that the pointer
165 experienced are coallesced into the event.
166
167 Example:
168 If a mouse experiences the following events:
169 - move +1, down, move +2, up, move +4, down, move +8
170 ...the events might be:
171 - move +7, down, move +8
172 ...or:
173 - move +1, down, move +14
174
175 TODO(ianh): expose the unfiltered uncoalesced stream of events for
176 programs that want more precision (e.g. drawing apps)
177
149 178
150 These data of all these events is an object with the following fields: 179 These data of all these events is an object with the following fields:
151 180
152 pointer: an integer assigned to this touch or pointer when it 181 pointer: an integer assigned to this touch or pointer when it
153 enters the system, never reused, increasing 182 enters the system, never reused, increasing
154 monotonically every time a new value is assigned, 183 monotonically every time a new value is assigned,
155 starting from 1 (if the system gets a new tap every 184 starting from 1 (if the system gets a new tap every
156 microsecond, this will cause a problem after 285 185 microsecond, this will cause a problem after 285
157 years) 186 years)
158 187
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 ...giving the angle of the axis of the stylus, 326 ...giving the angle of the axis of the stylus,
298 relative to the axis perpendicular to the screen 327 relative to the axis perpendicular to the screen
299 (thus 0 indicates the stylus is orthogonal to the 328 (thus 0 indicates the stylus is orthogonal to the
300 plane of the screen, while pi/2 indicates that the 329 plane of the screen, while pi/2 indicates that the
301 stylus is flat on the screen) 330 stylus is flat on the screen)
302 331
303 332
304 TODO(ianh): add an API that exposes the currently existing pointers, 333 TODO(ianh): add an API that exposes the currently existing pointers,
305 so that you can determine e.g. if you have a mouse. 334 so that you can determine e.g. if you have a mouse.
306 335
307 TODO(ianh): determine what the update frequency of these events should
308 be. One set of events per frame? Multiple updates per frame?
309 336
310 337
311 Wheel events 338 Wheel events
312 ------------ 339 ------------
313 340
314 When a wheel input device is turned, a 'wheel' event that bubbles is 341 When a wheel input device is turned, a 'wheel' event that bubbles is
315 fired at the application's document, with the following fields: 342 fired at the application's document, with the following fields:
316 343
317 wheel: an integer assigned to this wheel by the system. The 344 wheel: an integer assigned to this wheel by the system. The
318 same wheel on the same system must always be given 345 same wheel on the same system must always be given
(...skipping 13 matching lines...) Expand all
332 'pointer-add' event (see above). 359 'pointer-add' event (see above).
333 360
334 x: x-position relative to the top-left corner of the 361 x: x-position relative to the top-left corner of the
335 display, in global layout coordinates 362 display, in global layout coordinates
336 363
337 y: x-position relative to the top-left corner of the 364 y: x-position relative to the top-left corner of the
338 display, in global layout coordinates 365 display, in global layout coordinates
339 366
340 Note: The only wheels that are supported are mouse wheels and physical 367 Note: The only wheels that are supported are mouse wheels and physical
341 dials. Track balls are not reported as mouse wheels. 368 dials. Track balls are not reported as mouse wheels.
OLDNEW
« no previous file with comments | « sky/specs/keyboard.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698