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

Unified Diff: sky/sdk/lib/framework/components2/ink_well.dart

Issue 1173173002: Ink should propagate at a constant velocity (Closed) Base URL: git@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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/framework/components2/ink_well.dart
diff --git a/sky/sdk/lib/framework/components2/ink_well.dart b/sky/sdk/lib/framework/components2/ink_well.dart
index c0ac77740094fae0e36c6fc558f30e6b3714662e..4193d1cff86f196009a7d9da74b3cd95541b0ab2 100644
--- a/sky/sdk/lib/framework/components2/ink_well.dart
+++ b/sky/sdk/lib/framework/components2/ink_well.dart
@@ -8,29 +8,29 @@ import '../fn2.dart';
import '../rendering/box.dart';
import '../rendering/flex.dart';
import '../rendering/object.dart';
-import '../theme/view_configuration.dart' as config;
import 'dart:async';
import 'dart:collection';
import 'dart:math' as math;
import 'dart:sky' as sky;
const int _kSplashInitialOpacity = 0x80;
-const double _kSplashInitialSize = 0.0;
-const double _kSplashConfirmedDuration = 350.0;
-const double _kSplashUnconfirmedDuration = config.kDefaultLongPressTimeout;
const double _kSplashInitialDelay = 0.0; // we could delay initially in case the user scrolls
+const double _kSplashInitialSize = 0.0;
+const double _kSplashConfirmedVelocity = 0.3;
+const double _kSplashUnconfirmedVelocity = 0.1;
double _getSplashTargetSize(Size bounds, Point position) {
- return 2.0 * math.max(math.max(position.x, bounds.width - position.x),
- math.max(position.y, bounds.height - position.y));
+ return math.max(math.max(position.x, bounds.width - position.x),
+ math.max(position.y, bounds.height - position.y));
}
class InkSplash {
InkSplash(this.pointer, this.position, this.well) {
_targetRadius = _getSplashTargetSize(well.size, position);
+ double duration = _targetRadius / _kSplashUnconfirmedVelocity;
_radius = new AnimatedValue(_kSplashInitialSize, onChange: _handleRadiusChange);
- _radius.animateTo(_targetRadius, _kSplashUnconfirmedDuration,
- curve: easeOut, initialDelay: _kSplashInitialDelay);
+ _radius.animateTo(_targetRadius, duration, curve: easeOut,
+ initialDelay: _kSplashInitialDelay);
}
final int pointer;
@@ -41,8 +41,7 @@ class InkSplash {
AnimatedValue _radius;
void confirm() {
- double fractionRemaining = (_targetRadius - _radius.value) / _targetRadius;
- double duration = fractionRemaining * _kSplashConfirmedDuration;
+ double duration = (_targetRadius - _radius.value) / _kSplashConfirmedVelocity;
if (duration <= 0.0)
return;
_radius.animateTo(_targetRadius, duration, curve: easeOut);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698