| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import '../animation/generators.dart'; | 5 import '../animation/generators.dart'; |
| 6 import '../animation/mechanics.dart'; | 6 import '../animation/mechanics.dart'; |
| 7 import '../animation/scroll_behavior.dart'; | 7 import '../animation/scroll_behavior.dart'; |
| 8 import '../fn.dart'; | 8 import '../fn.dart'; |
| 9 import '../theme/view-configuration.dart' as config; | 9 import '../theme/view-configuration.dart' as config; |
| 10 import 'dart:math' as math; | 10 import 'dart:math' as math; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 ScrollBehavior scrollBehavior; | 21 ScrollBehavior scrollBehavior; |
| 22 double get scrollOffset => _scrollOffset; | 22 double get scrollOffset => _scrollOffset; |
| 23 | 23 |
| 24 double _scrollOffset = 0.0; | 24 double _scrollOffset = 0.0; |
| 25 Simulation _simulation; | 25 Simulation _simulation; |
| 26 | 26 |
| 27 Scrollable({Object key, this.scrollBehavior}) : super(key: key) { | 27 Scrollable({Object key, this.scrollBehavior}) : super(key: key) { |
| 28 onDidUnmount(_stopSimulation); | 28 onDidUnmount(_stopSimulation); |
| 29 } | 29 } |
| 30 | 30 |
| 31 Node buildContent(); | 31 UINode buildContent(); |
| 32 | 32 |
| 33 Node build() { | 33 UINode build() { |
| 34 return new EventTarget( | 34 return new EventListenerNode( |
| 35 buildContent(), | 35 buildContent(), |
| 36 onPointerDown: _handlePointerDown, | 36 onPointerDown: _handlePointerDown, |
| 37 onPointerUp: _handlePointerUpOrCancel, | 37 onPointerUp: _handlePointerUpOrCancel, |
| 38 onPointerCancel: _handlePointerUpOrCancel, | 38 onPointerCancel: _handlePointerUpOrCancel, |
| 39 onGestureFlingStart: _handleFlingStart, | 39 onGestureFlingStart: _handleFlingStart, |
| 40 onGestureFlingCancel: _handleFlingCancel, | 40 onGestureFlingCancel: _handleFlingCancel, |
| 41 onGestureScrollUpdate: _handleScrollUpdate, | 41 onGestureScrollUpdate: _handleScrollUpdate, |
| 42 onWheel: _handleWheel | 42 onWheel: _handleWheel |
| 43 ); | 43 ); |
| 44 } | 44 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 | 95 |
| 96 void _handleFlingCancel(sky.GestureEvent event) { | 96 void _handleFlingCancel(sky.GestureEvent event) { |
| 97 _startSimulation(_createParticle()); | 97 _startSimulation(_createParticle()); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void _handleWheel(sky.WheelEvent event) { | 100 void _handleWheel(sky.WheelEvent event) { |
| 101 scrollBy(-event.offsetY); | 101 scrollBy(-event.offsetY); |
| 102 } | 102 } |
| 103 } | 103 } |
| OLD | NEW |