mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 14:01:20 +08:00
chore(scrollView): calculate max scrollTo attempts
This commit is contained in:
@ -53,6 +53,7 @@ export class ScrollView {
|
|||||||
|
|
||||||
let xDistance = Math.abs(x - fromX);
|
let xDistance = Math.abs(x - fromX);
|
||||||
let yDistance = Math.abs(y - fromY);
|
let yDistance = Math.abs(y - fromY);
|
||||||
|
let maxAttempts = (duration / 16) + 100;
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
let startTime: number;
|
let startTime: number;
|
||||||
@ -62,7 +63,7 @@ export class ScrollView {
|
|||||||
function step() {
|
function step() {
|
||||||
attempts++;
|
attempts++;
|
||||||
|
|
||||||
if (!self._el || !self.isPlaying || attempts > 200) {
|
if (!self._el || !self.isPlaying || attempts > maxAttempts) {
|
||||||
self.isPlaying = false;
|
self.isPlaying = false;
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user