| OLD | NEW |
| (Empty) | |
| 1 UI Events |
| 2 ========= |
| 3 |
| 4 Pointer events |
| 5 -------------- |
| 6 |
| 7 Each touch or pointer is tracked individually. |
| 8 |
| 9 New touches and pointers can appear and disappear over time. |
| 10 |
| 11 When a new one enters the system, a 'pointer-added' event is fired at |
| 12 the application's document. |
| 13 |
| 14 When it is removed, a 'pointer-removed' event is fired at the |
| 15 application's document. |
| 16 |
| 17 When one switches from "up" to "down", the position of the tap is hit |
| 18 tested and a 'pointer-down' event is fired at the target element under |
| 19 the cursor, if any, or the document otherwise. |
| 20 |
| 21 When one moves, if it is "up" then a 'pointer-moved' event is fired at |
| 22 the application's document, otherwise if it is "down" then the event |
| 23 is fired at the element or document that was selected for the |
| 24 'pointer-down' event. |
| 25 |
| 26 When one switches from "down" to "up", a 'pointer-up' event is fired |
| 27 at the element or document that was selected for the 'pointer-down' |
| 28 event. |
| 29 |
| 30 |
| 31 These events all bubble and their data is an object with the following |
| 32 fields: |
| 33 |
| 34 pointer: an integer assigned to this touch or pointer when it |
| 35 enters the system, never reused, increasing monotonically |
| 36 every time a new value is assigned, starting from 1 (if |
| 37 the system gets a new tap every microsecond, this will |
| 38 cause a problem after 285 years) |
| 39 |
| 40 x: x-position relative to the top-left corner of the display, |
| 41 in global layout coordinates |
| 42 |
| 43 y: x-position relative to the top-left corner of the display, |
| 44 in global layout coordinates |
| 45 |
| 46 buttons: a bitfield of the buttons pressed, where 1 is the primary |
| 47 button, 2 is the secondary, and subsequent numbers refer |
| 48 to any other buttons |
| 49 |
| 50 TODO(ianh): add other fields for touches (radius/pressure, angle) |
| 51 |
| 52 TODO(ianh): should we use a different way to express buttons? e.g. |
| 53 create a new touch for the secondary button when it goes down, |
| 54 removing the touch when it goes back up? |
| 55 |
| 56 TODO(ianh): find a way to avoid the trap everyone always falls into of |
| 57 treating all the buttons as equivalent to a touch (e.g. right-clicking |
| 58 a button shouldn't trigger the button). For example, maybe we should |
| 59 remove 'buttons' and use different event names for the up/down state |
| 60 changes of non-primary buttons of pointers, like 'pointer-down-2' for |
| 61 the secondary button, 'pointer-down-3' for the middle mouse button, |
| 62 and so on. |
| 63 |
| 64 |
| 65 Wheel events |
| 66 ------------ |
| 67 |
| 68 When a wheel input device is turned, a 'wheel' event that bubbles is |
| 69 fired at the application's document, with the following fields: |
| 70 |
| 71 wheel: an integer assigned to this wheel by the system. The same |
| 72 wheel on the same system must always be given the same ID. |
| 73 The primary wheel (e.g. the vertical wheel on a mouse) |
| 74 must be given ID 1. |
| 75 |
| 76 delta: an floating point number representing the fraction of the |
| 77 wheel that was turned, with positive numbers representing |
| 78 a downward movement on vertical wheels, rightward movement |
| 79 on horizontal wheels, and a clockwise movement on wheels |
| 80 with a user-facing side. |
| 81 |
| 82 Additionally, if the wheel is associated with a pointer (e.g. a mouse |
| 83 wheel), the following fields must be present also: |
| 84 |
| 85 pointer: the integer assigned to the pointer in its 'pointer-add' |
| 86 event (see above). |
| 87 |
| 88 x: x-position relative to the top-left corner of the display, |
| 89 in global layout coordinates |
| 90 |
| 91 y: x-position relative to the top-left corner of the display, |
| 92 in global layout coordinates |
| 93 |
| 94 |
| 95 Text input events |
| 96 ----------------- |
| 97 |
| 98 TODO(ianh): keyboard events |
| OLD | NEW |