From 2f342d647e20454e902c4347e6d31f5d7ee344ad Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Fri, 15 Apr 2016 20:00:57 -0500 Subject: [PATCH] chore(scrollView): calculate max scrollTo attempts --- ionic/util/scroll-view.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ionic/util/scroll-view.ts b/ionic/util/scroll-view.ts index fe84f264e9..212acae63f 100644 --- a/ionic/util/scroll-view.ts +++ b/ionic/util/scroll-view.ts @@ -53,6 +53,7 @@ export class ScrollView { let xDistance = Math.abs(x - fromX); let yDistance = Math.abs(y - fromY); + let maxAttempts = (duration / 16) + 100; return new Promise(resolve => { let startTime: number; @@ -62,7 +63,7 @@ export class ScrollView { function step() { attempts++; - if (!self._el || !self.isPlaying || attempts > 200) { + if (!self._el || !self.isPlaying || attempts > maxAttempts) { self.isPlaying = false; resolve(); return;