From 760a6502e060149a63c082b91307c8b374b9f72e Mon Sep 17 00:00:00 2001 From: Hixie Date: Thu, 5 Mar 2015 15:46:21 -0800 Subject: [PATCH] fix the hang when clicking the drawer in the stocks app R=eseidel@chromium.org Review URL: https://codereview.chromium.org/980043005 --- examples/fn/widgets/drawer.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/fn/widgets/drawer.dart b/examples/fn/widgets/drawer.dart index 282310c53e..f4a3aa00bb 100644 --- a/examples/fn/widgets/drawer.dart +++ b/examples/fn/widgets/drawer.dart @@ -73,9 +73,11 @@ class DrawerAnimation { void _animateToPosition(double targetPosition) { double distance = (targetPosition - _position).abs(); - double targetDuration = distance / _kWidth * _kBaseSettleDurationMS; - double duration = math.min(targetDuration, _kMaxSettleDurationMS); - _animate(duration, _position, targetPosition, _kAnimationCurve); + if (distance != 0) { + double targetDuration = distance / _kWidth * _kBaseSettleDurationMS; + double duration = math.min(targetDuration, _kMaxSettleDurationMS); + _animate(duration, _position, targetPosition, _kAnimationCurve); + } } void handleFlingStart(event) {