提交 37c27faa 编写于 作者: H Hixie

fix the hang when clicking the drawer in the stocks app

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/980043005
上级 3a73d551
...@@ -73,9 +73,11 @@ class DrawerAnimation { ...@@ -73,9 +73,11 @@ class DrawerAnimation {
void _animateToPosition(double targetPosition) { void _animateToPosition(double targetPosition) {
double distance = (targetPosition - _position).abs(); double distance = (targetPosition - _position).abs();
double targetDuration = distance / _kWidth * _kBaseSettleDurationMS; if (distance != 0) {
double duration = math.min(targetDuration, _kMaxSettleDurationMS); double targetDuration = distance / _kWidth * _kBaseSettleDurationMS;
_animate(duration, _position, targetPosition, _kAnimationCurve); double duration = math.min(targetDuration, _kMaxSettleDurationMS);
_animate(duration, _position, targetPosition, _kAnimationCurve);
}
} }
void handleFlingStart(event) { void handleFlingStart(event) {
......
...@@ -66,6 +66,7 @@ class AnimationGenerator extends FrameGenerator { ...@@ -66,6 +66,7 @@ class AnimationGenerator extends FrameGenerator {
this.curve: linear, this.curve: linear,
Function onDone Function onDone
}):super(onDone: onDone) { }):super(onDone: onDone) {
assert(duration > 0);
double startTime = 0.0; double startTime = 0.0;
_stream = super.onTick.map((timeStamp) { _stream = super.onTick.map((timeStamp) {
if (startTime == 0.0) if (startTime == 0.0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册