OLD | NEW |
1 <!-- | 1 <!-- |
2 // Copyright 2015 The Chromium Authors. All rights reserved. | 2 // Copyright 2015 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 --> | 5 --> |
6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> | 6 <import src="/sky/framework/sky-element/sky-element.sky" as="SkyElement" /> |
7 <import src="/sky/framework/fling-curve.sky" as="FlingCurve" /> | 7 <import src="/sky/framework/fling-curve.sky" as="FlingCurve" /> |
8 | 8 |
9 <sky-element | 9 <sky-element |
10 name="sky-scrollable" | 10 name="sky-scrollable" |
11 on-gesturescrollstart="handleScrollStart_" | 11 on-gesturescrollstart="handleScrollStart_" |
12 on-gesturescrollend="handleScrollEnd_" | 12 on-gesturescrollend="handleScrollEnd_" |
13 on-gesturescrollupdate="handleScrollUpdate_" | 13 on-gesturescrollupdate="handleScrollUpdate_" |
14 on-gestureflingstart="handleFlingStart_" | 14 on-gestureflingstart="handleFlingStart_" |
15 on-gestureflingcancel="handleFlingCancel_"> | 15 on-gestureflingcancel="handleFlingCancel_" |
| 16 on-wheel="handleWheel_"> |
16 <template> | 17 <template> |
17 <style> | 18 <style> |
18 :host { | 19 :host { |
19 overflow: hidden; | 20 overflow: hidden; |
20 position: relative; | 21 position: relative; |
21 } | 22 } |
22 #scrollable { | 23 #scrollable { |
23 transform: translateY(0); | 24 transform: translateY(0); |
24 } | 25 } |
25 #vbar { | 26 #vbar { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 109 } |
109 | 110 |
110 handleFlingStart_(event) { | 111 handleFlingStart_(event) { |
111 this.flingCurve_ = new FlingCurve(-event.velocityY, event.timeStamp); | 112 this.flingCurve_ = new FlingCurve(-event.velocityY, event.timeStamp); |
112 this.scheduleFlingUpdate_(); | 113 this.scheduleFlingUpdate_(); |
113 } | 114 } |
114 | 115 |
115 handleFlingCancel_(event) { | 116 handleFlingCancel_(event) { |
116 this.stopFling_(); | 117 this.stopFling_(); |
117 } | 118 } |
| 119 |
| 120 handleWheel_(event) { |
| 121 this.scrollBy(-event.offsetY); |
| 122 } |
118 }.register(); | 123 }.register(); |
119 </script> | 124 </script> |
120 </sky-element> | 125 </sky-element> |
OLD | NEW |