Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: sky/sdk/lib/framework/components2/scrollable.dart

Issue 1174023003: Remove one more use of mirrors: Components now have to explicitly sync their fields. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 '../fn2.dart'; 8 import '../fn2.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;
11 import 'dart:sky' as sky; 11 import 'dart:sky' as sky;
12 12
13 const double _kMillisecondsPerSecond = 1000.0; 13 const double _kMillisecondsPerSecond = 1000.0;
14 14
15 double _velocityForFlingGesture(sky.GestureEvent event) { 15 double _velocityForFlingGesture(sky.GestureEvent event) {
16 return math.max(-config.kMaxFlingVelocity, math.min(config.kMaxFlingVelocity, 16 return math.max(-config.kMaxFlingVelocity, math.min(config.kMaxFlingVelocity,
17 -event.velocityY)) / _kMillisecondsPerSecond; 17 -event.velocityY)) / _kMillisecondsPerSecond;
18 } 18 }
19 19
20 abstract class ScrollClient { 20 abstract class ScrollClient {
21 bool ancestorScrolled(Scrollable ancestor); 21 bool ancestorScrolled(Scrollable ancestor);
22 } 22 }
23 23
24 abstract class Scrollable extends Component { 24 abstract class Scrollable extends Component {
25 25
26 Scrollable({Object key}) : super(key: key) { 26 Scrollable({Object key}) : super(key: key, stateful: true) {
27 onDidUnmount(_stopSimulation); 27 onDidUnmount(_stopSimulation);
28 } 28 }
29 29
30 void syncFields(Scrollable source) { }
31
30 double _scrollOffset = 0.0; 32 double _scrollOffset = 0.0;
31 double get scrollOffset => _scrollOffset; 33 double get scrollOffset => _scrollOffset;
32 34
33 ScrollBehavior _scrollBehavior; 35 ScrollBehavior _scrollBehavior;
34 ScrollBehavior createScrollBehavior(); 36 ScrollBehavior createScrollBehavior();
35 ScrollBehavior get scrollBehavior { 37 ScrollBehavior get scrollBehavior {
36 if (_scrollBehavior == null) 38 if (_scrollBehavior == null)
37 _scrollBehavior = createScrollBehavior(); 39 _scrollBehavior = createScrollBehavior();
38 return _scrollBehavior; 40 return _scrollBehavior;
39 } 41 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 140
139 void _handleFlingCancel(sky.GestureEvent event) { 141 void _handleFlingCancel(sky.GestureEvent event) {
140 _startSimulation(_createParticle()); 142 _startSimulation(_createParticle());
141 } 143 }
142 144
143 void _handleWheel(sky.WheelEvent event) { 145 void _handleWheel(sky.WheelEvent event) {
144 scrollBy(-event.offsetY); 146 scrollBy(-event.offsetY);
145 } 147 }
146 148
147 } 149 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/radio.dart ('k') | sky/sdk/lib/framework/components2/tool_bar.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698