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 html; | 5 part of html; |
6 | 6 |
7 /// @domName $DOMNAME | 7 @DomName("$DOMNAME") |
8 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 8 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
9 $!MEMBERS | 9 $!MEMBERS |
10 | 10 |
11 $if DART2JS | 11 $if DART2JS |
12 /** @domName WheelEvent.deltaY */ | 12 @DomName("WheelEvent.deltaY") |
13 num get deltaY { | 13 num get deltaY { |
14 if (JS('bool', '#.deltaY !== undefined', this)) { | 14 if (JS('bool', '#.deltaY !== undefined', this)) { |
15 // W3C WheelEvent | 15 // W3C WheelEvent |
16 return this._deltaY; | 16 return this._deltaY; |
17 } else if (JS('bool', '#.wheelDelta !== undefined', this)) { | 17 } else if (JS('bool', '#.wheelDelta !== undefined', this)) { |
18 // Chrome and IE | 18 // Chrome and IE |
19 return this._wheelDelta; | 19 return this._wheelDelta; |
20 } else if (JS('bool', '#.detail !== undefined', this)) { | 20 } else if (JS('bool', '#.detail !== undefined', this)) { |
21 // Firefox | 21 // Firefox |
22 | 22 |
23 // Handle DOMMouseScroll case where it uses detail and the axis to | 23 // Handle DOMMouseScroll case where it uses detail and the axis to |
24 // differentiate. | 24 // differentiate. |
25 if (JS('bool', '#.axis == MouseScrollEvent.VERTICAL_AXIS', this)) { | 25 if (JS('bool', '#.axis == MouseScrollEvent.VERTICAL_AXIS', this)) { |
26 var detail = this._detail; | 26 var detail = this._detail; |
27 // Firefox is normally the number of lines to scale (normally 3) | 27 // Firefox is normally the number of lines to scale (normally 3) |
28 // so multiply it by 40 to get pixels to move, matching IE & WebKit. | 28 // so multiply it by 40 to get pixels to move, matching IE & WebKit. |
29 if (detail < 100) { | 29 if (detail < 100) { |
30 return detail * 40; | 30 return detail * 40; |
31 } | 31 } |
32 return detail; | 32 return detail; |
33 } | 33 } |
34 return 0; | 34 return 0; |
35 } | 35 } |
36 throw new UnsupportedError( | 36 throw new UnsupportedError( |
37 'deltaY is not supported'); | 37 'deltaY is not supported'); |
38 } | 38 } |
39 | 39 |
40 /** @domName WheelEvent.deltaX */ | 40 @DomName("WheelEvent.deltaX") |
41 num get deltaX { | 41 num get deltaX { |
42 if (JS('bool', '#.deltaX !== undefined', this)) { | 42 if (JS('bool', '#.deltaX !== undefined', this)) { |
43 // W3C WheelEvent | 43 // W3C WheelEvent |
44 return this._deltaX; | 44 return this._deltaX; |
45 } else if (JS('bool', '#.wheelDeltaX !== undefined', this)) { | 45 } else if (JS('bool', '#.wheelDeltaX !== undefined', this)) { |
46 // Chrome | 46 // Chrome |
47 return this._wheelDeltaX; | 47 return this._wheelDeltaX; |
48 } else if (JS('bool', '#.detail !== undefined', this)) { | 48 } else if (JS('bool', '#.detail !== undefined', this)) { |
49 // Firefox and IE. | 49 // Firefox and IE. |
50 // IE will have detail set but will not set axis. | 50 // IE will have detail set but will not set axis. |
(...skipping 24 matching lines...) Expand all Loading... |
75 } | 75 } |
76 | 76 |
77 num get _deltaY => JS('num', '#.deltaY', this); | 77 num get _deltaY => JS('num', '#.deltaY', this); |
78 num get _deltaX => JS('num', '#.deltaX', this); | 78 num get _deltaX => JS('num', '#.deltaX', this); |
79 num get _wheelDelta => JS('num', '#.wheelDelta', this); | 79 num get _wheelDelta => JS('num', '#.wheelDelta', this); |
80 num get _wheelDeltaX => JS('num', '#.wheelDeltaX', this); | 80 num get _wheelDeltaX => JS('num', '#.wheelDeltaX', this); |
81 num get _detail => JS('num', '#.detail', this); | 81 num get _detail => JS('num', '#.detail', this); |
82 int get _deltaMode => JS('int', '#.deltaMode', this); | 82 int get _deltaMode => JS('int', '#.deltaMode', this); |
83 | 83 |
84 $else | 84 $else |
85 /** @domName WheelEvent.deltaX */ | 85 @DomName("WheelEvent.deltaX") |
86 num get deltaX => $dom_wheelDeltaX; | 86 num get deltaX => $dom_wheelDeltaX; |
87 /** @domName WheelEvent.deltaY */ | 87 @DomName("WheelEvent.deltaY") |
88 num get deltaY => $dom_wheelDeltaY; | 88 num get deltaY => $dom_wheelDeltaY; |
89 /** @domName WheelEvent.deltaMode */ | 89 @DomName("WheelEvent.deltaMode") |
90 int get deltaMode => 0; | 90 int get deltaMode => 0; |
91 | 91 |
92 $endif | 92 $endif |
93 } | 93 } |
OLD | NEW |