chore(scrollView): calculate max scrollTo attempts

This commit is contained in:
Adam Bradley
2016-04-15 20:00:57 -05:00
parent 16e54d8d77
commit 2f342d647e

View File

@ -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;