| OLD | NEW |
| 1 UI Events | 1 UI 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 - keyboards |
| 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 |
| 23 The following interactions are intended to be easy to handle: | 23 The following interactions are intended to be easy to handle: |
| 24 - one finger starts panning, another finger is placed on the surface | 24 - one finger starts panning, another finger is placed on the surface |
| 25 (and ignored), the first finger is lifted, and the second finger | 25 (and ignored), the first finger is lifted, and the second finger |
| 26 continues panning (without the scroll position jumping when the | 26 continues panning (without the scroll position jumping when the |
| 27 first finger is lifted) | 27 first finger is lifted) |
| 28 - right-clicking doesn't trigger buttons by default | 28 - right-clicking doesn't trigger buttons by default |
| 29 - fingers after the first don't trigger buttons by default | 29 - fingers after the first within a surface don't trigger buttons by |
| 30 default |
| 31 - if there are two independent surfaces, they capture fingers |
| 32 unrelated to each other |
| 30 | 33 |
| 31 Frameworks are responsible for converting pointer events described | 34 Frameworks are responsible for converting pointer events described |
| 32 below into widget-specific events such as the following: | 35 below into widget-specific events such as the following: |
| 33 - a click/tap/activation, as distinct from a short drag | 36 - a click/tap/activation, as distinct from a short drag |
| 34 - a context menu request (e.g. right-click, long-press) | 37 - a context menu request (e.g. right-click, long-press) |
| 35 - a drag (moving an item) | 38 - a drag (moving an item) |
| 36 - a pan (scroll) | 39 - a pan (scroll) |
| 37 - a zoom/rotation (whether using two finger gestures, or one finger | 40 - a zoom/rotation (whether using two finger gestures, or one finger |
| 38 with the double-tap-and-hold gesture) | 41 with the double-tap-and-hold gesture) |
| 39 - a double-tap autozoom | 42 - a double-tap autozoom |
| (...skipping 28 matching lines...) Expand all Loading... |
| 68 tested and a 'pointer-down' event is fired at the target element under | 71 tested and a 'pointer-down' event is fired at the target element under |
| 69 the cursor, if any, or the document otherwise. The return value, if | 72 the cursor, if any, or the document otherwise. The return value, if |
| 70 it's a node, is used as the target of future move and up events until | 73 it's a node, is used as the target of future move and up events until |
| 71 this touch goes up. If there is no return value, the target continues | 74 this touch goes up. If there is no return value, the target continues |
| 72 to be the application's document. | 75 to be the application's document. |
| 73 | 76 |
| 74 A pointer that is "down" is captured -- all events for that pointer | 77 A pointer that is "down" is captured -- all events for that pointer |
| 75 will be routed to the chosen target until the pointer goes up, | 78 will be routed to the chosen target until the pointer goes up, |
| 76 regardless of whether it's in that target's visible area. | 79 regardless of whether it's in that target's visible area. |
| 77 | 80 |
| 81 When an element captures a pointer and it has no captured pointers so |
| 82 far, if either there are no buttons (touch, stylus) or only the |
| 83 primary button is active (mouse) and this is not an inverted stylus, |
| 84 then that pointer is marked as "primary" for that element. The pointer |
| 85 remains the primary pointer until the corresponding pointer-up event |
| 86 (even if the buttons change). |
| 87 |
| 78 When one moves, if it is "up" then a 'pointer-moved' event is fired at | 88 When one moves, if it is "up" then a 'pointer-moved' event is fired at |
| 79 the application's document, otherwise if it is "down" then the event | 89 the application's document, otherwise if it is "down" then the event |
| 80 is fired at the element or document that was selected for the | 90 is fired at the element or document that was selected for the |
| 81 'pointer-down' event. | 91 'pointer-down' event (the capturing element). If the return value of a |
| 92 'pointer-moved' event is 'cancel', then pretend that the pointer moved |
| 93 to 'up', send 'pointer-up' as described below, and drop all events for |
| 94 this pointer until such time as it actually changes to be 'up'. |
| 82 | 95 |
| 83 When one switches from "down" to "up", a 'pointer-up' event is fired | 96 When one switches from "down" to "up", a 'pointer-up' event is fired |
| 84 at the element or document that was selected for the 'pointer-down' | 97 at the element or document that was selected for the 'pointer-down' |
| 85 event. | 98 event (the capturing target). |
| 86 | 99 |
| 87 When there are no "down" pointers and one switches to "down", if | |
| 88 either there are no buttons (touch) or only the primary button is | |
| 89 active (mouse, stylus) and this is not an inverted stylus, then this | |
| 90 becomes the "primary" pointer. The pointer remains the primary pointer | |
| 91 until the corresponding pointer-up event (even if the buttons change). | |
| 92 At the time of a pointer-up event, if there is another pointer that is | 100 At the time of a pointer-up event, if there is another pointer that is |
| 93 already down and is of the same kind, and that has either no buttons | 101 already down, captured by the same element, and is of the same kind, |
| 94 or only its primary button active, then that becomes the new primary | 102 and that has either no buttons or only its primary button active, then |
| 95 pointer. | 103 that becomes the new primary pointer for that element before the |
| 104 pointer-up event is sent. Otherwise, the primary pointer stops being |
| 105 primary just after the pointer-up. |
| 106 |
| 107 Nothing special happens when a capturing target moves in the DOM. |
| 108 |
| 109 The x and y position of an -up or -down event always match those of |
| 110 the previous -moved or -added event, so their dx and dy are always 0. |
| 96 | 111 |
| 97 | 112 |
| 98 These events all bubble and their data is an object with the following | 113 These events all bubble and their data is an object with the following |
| 99 fields: | 114 fields: |
| 100 | 115 |
| 101 pointer: an integer assigned to this touch or pointer when it | 116 pointer: an integer assigned to this touch or pointer when it |
| 102 enters the system, never reused, increasing | 117 enters the system, never reused, increasing |
| 103 monotonically every time a new value is assigned, | 118 monotonically every time a new value is assigned, |
| 104 starting from 1 (if the system gets a new tap every | 119 starting from 1 (if the system gets a new tap every |
| 105 microsecond, this will cause a problem after 285 | 120 microsecond, this will cause a problem after 285 |
| 106 years) | 121 years) |
| 107 | 122 |
| 108 kind: one of 'touch', 'mouse', 'stylus', 'inverted-stylus' | 123 kind: one of 'touch', 'mouse', 'stylus', 'inverted-stylus' |
| 109 | 124 |
| 110 x: x-position relative to the top-left corner of the | 125 x: x-position relative to the top-left corner of the |
| 111 surface of the node on which the event was fired | 126 surface of the node on which the event was fired |
| 112 | 127 |
| 113 y: y-position relative to the top-left corner of the | 128 y: y-position relative to the top-left corner of the |
| 114 surface of the node on which the event was fired | 129 surface of the node on which the event was fired |
| 115 | 130 |
| 131 dx: difference in x-position since last pointer-moved |
| 132 event |
| 133 |
| 134 dy: difference in y-position since last pointer-moved |
| 135 event |
| 136 |
| 116 buttons: a bitfield of the buttons pressed, from the following | 137 buttons: a bitfield of the buttons pressed, from the following |
| 117 list: | 138 list: |
| 118 | 139 |
| 119 1: primary mouse button (not available on stylus) | 140 1: primary mouse button (not available on stylus) |
| 120 | 141 |
| 121 2: secondary mouse button, primary stylus button | 142 2: secondary mouse button, primary stylus button |
| 122 | 143 |
| 123 3: middle mouse button, secondary stylus button | 144 3: middle mouse button, secondary stylus button |
| 124 | 145 |
| 125 4: back button | 146 4: back button |
| (...skipping 12 matching lines...) Expand all Loading... |
| 138 note that stylus buttons can be pressed even when the | 159 note that stylus buttons can be pressed even when the |
| 139 pointer is not "down" | 160 pointer is not "down" |
| 140 | 161 |
| 141 down: true if the pointer is down (in pointer-down event or | 162 down: true if the pointer is down (in pointer-down event or |
| 142 subsequent pointer-move events); false otherwise (in | 163 subsequent pointer-move events); false otherwise (in |
| 143 pointer-added, pointer-up, and pointer-removed | 164 pointer-added, pointer-up, and pointer-removed |
| 144 events, and in pointer-move events that aren't | 165 events, and in pointer-move events that aren't |
| 145 between pointer-down and pointer-up events) | 166 between pointer-down and pointer-up events) |
| 146 | 167 |
| 147 primary: true if this is a primary pointer/touch (see above) | 168 primary: true if this is a primary pointer/touch (see above) |
| 169 can only be set for pointer-moved and pointer-up |
| 148 | 170 |
| 149 obscured: true if the system was rendering another view on top | 171 obscured: true if the system was rendering another view on top |
| 150 of the sky application at the time of the event (this | 172 of the sky application at the time of the event (this |
| 151 is intended to enable click-jacking protections) | 173 is intended to enable click-jacking protections) |
| 152 | 174 |
| 153 | 175 |
| 154 When primary is true, the following fields are available: | |
| 155 | |
| 156 dx: if primary, then this is the delta from the | |
| 157 x-position at the time that the pointer became | |
| 158 primary. | |
| 159 | |
| 160 dy: if primary, then this is the delta from the | |
| 161 x-position at the time that the pointer became | |
| 162 primary. | |
| 163 | |
| 164 | |
| 165 When down is true: | 176 When down is true: |
| 166 | 177 |
| 167 pressure: the pressure of the touch as a number ranging from | 178 pressure: the pressure of the touch as a number ranging from |
| 168 0.0, indicating a touch with no discernible pressure, | 179 0.0, indicating a touch with no discernible pressure, |
| 169 to 1.0, indicating a touch with "normal" pressure, | 180 to 1.0, indicating a touch with "normal" pressure, |
| 170 and possibly beyond, indicating a stronger touch; for | 181 and possibly beyond, indicating a stronger touch; for |
| 171 devices that do not detect pressure (e.g. mice), | 182 devices that do not detect pressure (e.g. mice), |
| 172 returns 1.0 | 183 returns 1.0 |
| 173 | 184 |
| 174 pressure-min: the minimum value that pressure can return for this | 185 pressure-min: the minimum value that pressure can return for this |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 display, in global layout coordinates | 289 display, in global layout coordinates |
| 279 | 290 |
| 280 Note: The only wheels that are supported are mouse wheels and physical | 291 Note: The only wheels that are supported are mouse wheels and physical |
| 281 dials. Track balls are not reported as mouse wheels. | 292 dials. Track balls are not reported as mouse wheels. |
| 282 | 293 |
| 283 | 294 |
| 284 Text input events | 295 Text input events |
| 285 ----------------- | 296 ----------------- |
| 286 | 297 |
| 287 TODO(ianh): keyboard events | 298 TODO(ianh): keyboard events |
| OLD | NEW |