| 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 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 import '../animation/generators.dart'; | 8 import '../animation/generators.dart'; |
| 9 import '../animation/mechanics.dart'; | 9 import '../animation/mechanics.dart'; |
| 10 import '../animation/scroll_behavior.dart'; | 10 import '../animation/scroll_behavior.dart'; |
| 11 import '../theme/view_configuration.dart' as config; | 11 import '../theme2/edges.dart'; |
| 12 import '../theme2/view_configuration.dart' as config; |
| 13 import 'material.dart'; |
| 12 import 'wrappers.dart'; | 14 import 'wrappers.dart'; |
| 13 | 15 |
| 14 const double _kMillisecondsPerSecond = 1000.0; | 16 const double _kMillisecondsPerSecond = 1000.0; |
| 15 | 17 |
| 16 double _velocityForFlingGesture(sky.GestureEvent event) { | 18 double _velocityForFlingGesture(sky.GestureEvent event) { |
| 17 return math.max(-config.kMaxFlingVelocity, math.min(config.kMaxFlingVelocity, | 19 return math.max(-config.kMaxFlingVelocity, math.min(config.kMaxFlingVelocity, |
| 18 -event.velocityY)) / _kMillisecondsPerSecond; | 20 -event.velocityY)) / _kMillisecondsPerSecond; |
| 19 } | 21 } |
| 20 | 22 |
| 21 abstract class ScrollClient { | 23 abstract class ScrollClient { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 _scrollBehavior = createScrollBehavior(); | 40 _scrollBehavior = createScrollBehavior(); |
| 39 return _scrollBehavior; | 41 return _scrollBehavior; |
| 40 } | 42 } |
| 41 | 43 |
| 42 Simulation _simulation; | 44 Simulation _simulation; |
| 43 | 45 |
| 44 UINode buildContent(); | 46 UINode buildContent(); |
| 45 | 47 |
| 46 UINode build() { | 48 UINode build() { |
| 47 return new EventListenerNode( | 49 return new EventListenerNode( |
| 48 buildContent(), | 50 new Material( |
| 51 child: buildContent(), |
| 52 edge: MaterialEdge.canvas |
| 53 ), |
| 49 onPointerDown: _handlePointerDown, | 54 onPointerDown: _handlePointerDown, |
| 50 onPointerUp: _handlePointerUpOrCancel, | 55 onPointerUp: _handlePointerUpOrCancel, |
| 51 onPointerCancel: _handlePointerUpOrCancel, | 56 onPointerCancel: _handlePointerUpOrCancel, |
| 52 onGestureFlingStart: _handleFlingStart, | 57 onGestureFlingStart: _handleFlingStart, |
| 53 onGestureFlingCancel: _handleFlingCancel, | 58 onGestureFlingCancel: _handleFlingCancel, |
| 54 onGestureScrollUpdate: _handleScrollUpdate, | 59 onGestureScrollUpdate: _handleScrollUpdate, |
| 55 onWheel: _handleWheel | 60 onWheel: _handleWheel |
| 56 ); | 61 ); |
| 57 } | 62 } |
| 58 | 63 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 149 |
| 145 void _handleFlingCancel(sky.GestureEvent event) { | 150 void _handleFlingCancel(sky.GestureEvent event) { |
| 146 _startSimulation(_createParticle()); | 151 _startSimulation(_createParticle()); |
| 147 } | 152 } |
| 148 | 153 |
| 149 void _handleWheel(sky.WheelEvent event) { | 154 void _handleWheel(sky.WheelEvent event) { |
| 150 scrollBy(-event.offsetY); | 155 scrollBy(-event.offsetY); |
| 151 } | 156 } |
| 152 | 157 |
| 153 } | 158 } |
| OLD | NEW |