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

Side by Side Diff: sky/framework/components/ink_splash.dart

Issue 1117143003: [Effen] Port fn.dart from the legacy sky.Node backend to the RenderNode backend, which is currently… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Tweak debug functions as suggested Created 5 years, 7 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/animated_value.dart'; 5 import '../animation/animated_value.dart';
6 import '../animation/curves.dart'; 6 import '../animation/curves.dart';
7 import '../fn.dart'; 7 import '../fn.dart';
8 import '../theme/view_configuration.dart' as config; 8 import '../theme/view_configuration.dart' as config;
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:math' as math; 10 import 'dart:math' as math;
11 import 'dart:sky' as sky; 11 import '../layout.dart';
12 12
13 const double _kSplashConfirmedDuration = 350.0; 13 const double _kSplashConfirmedDuration = 350.0;
14 const double _kSplashUnconfirmedDuration = config.kDefaultLongPressTimeout; 14 const double _kSplashUnconfirmedDuration = config.kDefaultLongPressTimeout;
15 const double _kSplashAbortDuration = 100.0; 15 const double _kSplashAbortDuration = 100.0;
16 const double _kSplashInitialDelay = 0.0; // we could delay initially in case the user scrolls 16 const double _kSplashInitialDelay = 0.0; // we could delay initially in case the user scrolls
17 17
18 double _getSplashTargetSize(sky.ClientRect rect, double x, double y) { 18 double _getSplashTargetSize(Rect rect, double x, double y) {
19 return 2.0 * math.max(math.max(x - rect.left, rect.right - x), 19 return 2.0 * math.max(math.max(x - rect.x, rect.x + rect.width - x),
20 math.max(y - rect.top, rect.bottom - y)); 20 math.max(y - rect.y, rect.y + rect.height - y));
21 } 21 }
22 22
23 class SplashController { 23 class SplashController {
24 final int pointer; 24 final int pointer;
25 Stream<String> get onStyleChanged => _styleStream; 25 Stream<String> get onStyleChanged => _styleStream;
26 26
27 final AnimatedValue _size = new AnimatedValue(0.0); 27 final AnimatedValue _size = new AnimatedValue(0.0);
28 double _offsetX; 28 double _offsetX;
29 double _offsetY; 29 double _offsetY;
30 double _lastSize = 0.0; 30 double _lastSize = 0.0;
(...skipping 18 matching lines...) Expand all
49 double durationRemaining = _size.remainingTime; 49 double durationRemaining = _size.remainingTime;
50 if (durationRemaining <= _kSplashAbortDuration) 50 if (durationRemaining <= _kSplashAbortDuration)
51 return; 51 return;
52 _size.animateTo(_targetSize, _kSplashAbortDuration, curve: easeOut); 52 _size.animateTo(_targetSize, _kSplashAbortDuration, curve: easeOut);
53 } 53 }
54 54
55 void cancel() { 55 void cancel() {
56 _size.stop(); 56 _size.stop();
57 } 57 }
58 58
59 SplashController(sky.ClientRect rect, double x, double y, 59 SplashController(Rect rect, double x, double y,
60 { this.pointer, Function onDone }) 60 { this.pointer, Function onDone })
61 : _offsetX = x - rect.left, 61 : _offsetX = x - rect.x,
62 _offsetY = y - rect.top, 62 _offsetY = y - rect.y,
63 _targetSize = _getSplashTargetSize(rect, x, y) { 63 _targetSize = _getSplashTargetSize(rect, x, y) {
64 64
65 _styleStream = _size.onValueChanged.map((p) { 65 _styleStream = _size.onValueChanged.map((p) {
66 if (p == _targetSize) { 66 if (p == _targetSize) {
67 onDone(); 67 onDone();
68 } 68 }
69 double size; 69 double size;
70 if (_growing) { 70 if (_growing) {
71 size = p; 71 size = p;
72 _lastSize = p; 72 _lastSize = p;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 style: _clipperStyle, 132 style: _clipperStyle,
133 children: [ 133 children: [
134 new Container( 134 new Container(
135 inlineStyle: _inlineStyle, 135 inlineStyle: _inlineStyle,
136 style: _splashStyle 136 style: _splashStyle
137 ) 137 )
138 ] 138 ]
139 ); 139 );
140 } 140 }
141 } 141 }
OLDNEW
« no previous file with comments | « sky/framework/components/fixed_height_scrollable.dart ('k') | sky/framework/components/ink_well.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698