| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 7 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
| 8 | 8 |
| 9 factory WheelEvent(String type, | 9 factory WheelEvent(String type, |
| 10 {Window view, int deltaX: 0, int deltaY: 0, | 10 {Window view, int deltaX: 0, int deltaY: 0, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 axis = JS('int', 'MouseScrollEvent.VERTICAL_AXIS'); | 58 axis = JS('int', 'MouseScrollEvent.VERTICAL_AXIS'); |
| 59 } else if (deltaX != 0) { | 59 } else if (deltaX != 0) { |
| 60 detail = deltaX; | 60 detail = deltaX; |
| 61 axis = JS('int', 'MouseScrollEvent.HORIZONTAL_AXIS'); | 61 axis = JS('int', 'MouseScrollEvent.HORIZONTAL_AXIS'); |
| 62 } | 62 } |
| 63 event._initMouseScrollEvent(type, canBubble, cancelable, view, detail, | 63 event._initMouseScrollEvent(type, canBubble, cancelable, view, detail, |
| 64 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, | 64 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
| 65 metaKey, button, relatedTarget, axis); | 65 metaKey, button, relatedTarget, axis); |
| 66 } else { | 66 } else { |
| 67 $else | 67 $else |
| 68 // Dartium always needs these flipped because we're essentially always | 68 // Dartium always needs these flipped because we're using the legacy |
| 69 // polyfilling (see similar dart2js code as well) | 69 // _initWebKitWheelEvent instead of the more modern WheelEvent constructor |
| 70 // which isn't yet properly exposed by the Dartium bindings. |
| 70 deltaX = -deltaX; | 71 deltaX = -deltaX; |
| 71 deltaY = -deltaY; | 72 deltaY = -deltaY; |
| 72 $endif | 73 $endif |
| 73 // Fallthrough for Dartium. | 74 // Fallthrough for Dartium. |
| 74 event._initMouseEvent(type, canBubble, cancelable, view, detail, | 75 event._initMouseEvent(type, canBubble, cancelable, view, detail, |
| 75 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, | 76 screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
| 76 metaKey, button, relatedTarget); | 77 metaKey, button, relatedTarget); |
| 77 event._initWebKitWheelEvent(deltaX, | 78 event._initWebKitWheelEvent(deltaX, deltaY, |
| 78 deltaY ~/ 120, // Chrome does an auto-convert to pixels. | |
| 79 view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, | 79 view, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, |
| 80 metaKey); | 80 metaKey); |
| 81 $if DART2JS | 81 $if DART2JS |
| 82 } | 82 } |
| 83 $endif | 83 $endif |
| 84 | 84 |
| 85 return event; | 85 return event; |
| 86 } | 86 } |
| 87 | 87 |
| 88 $!MEMBERS | 88 $!MEMBERS |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 $else | 223 $else |
| 224 /** | 224 /** |
| 225 * The amount that is expected to scroll horizontally, in units determined by | 225 * The amount that is expected to scroll horizontally, in units determined by |
| 226 * [deltaMode]. | 226 * [deltaMode]. |
| 227 * | 227 * |
| 228 * See also: | 228 * See also: |
| 229 * | 229 * |
| 230 * * [WheelEvent.deltaX](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html
/DOM3-Events.html#events-WheelEvent-deltaX) from the W3C. | 230 * * [WheelEvent.deltaX](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html
/DOM3-Events.html#events-WheelEvent-deltaX) from the W3C. |
| 231 */ | 231 */ |
| 232 @DomName('WheelEvent.deltaX') | 232 @DomName('WheelEvent.deltaX') |
| 233 num get deltaX => -_wheelDeltaX; | 233 num get deltaX => _deltaX; |
| 234 | 234 |
| 235 /** | 235 /** |
| 236 * The amount that is expected to scroll vertically, in units determined by | 236 * The amount that is expected to scroll vertically, in units determined by |
| 237 * [deltaMode]. | 237 * [deltaMode]. |
| 238 * | 238 * |
| 239 * See also: | 239 * See also: |
| 240 * | 240 * |
| 241 * * [WheelEvent.deltaY](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html
/DOM3-Events.html#events-WheelEvent-deltaY) from the W3C. | 241 * * [WheelEvent.deltaY](http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html
/DOM3-Events.html#events-WheelEvent-deltaY) from the W3C. |
| 242 */ | 242 */ |
| 243 @DomName('WheelEvent.deltaY') | 243 @DomName('WheelEvent.deltaY') |
| 244 num get deltaY => -_wheelDeltaY; | 244 num get deltaY => _deltaY; |
| 245 $endif | 245 $endif |
| 246 } | 246 } |
| OLD | NEW |