mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Fixed infinity problem in scroll view
I guess you can't divide by zero still.
This commit is contained in:
@ -122,6 +122,8 @@
|
||||
_scrollTo: function(x, y, time, easing) {
|
||||
var _this = this;
|
||||
|
||||
time = time || 0;
|
||||
|
||||
var start = Date.now();
|
||||
|
||||
easing = easing || 'cubic-bezier(0.1, 0.57, 0.1, 1)';
|
||||
@ -150,6 +152,10 @@
|
||||
time = 0;
|
||||
}
|
||||
|
||||
if(time == Infinity) {
|
||||
debugger;
|
||||
}
|
||||
|
||||
var dx = ox - x;
|
||||
var dy = oy - y;
|
||||
|
||||
@ -336,6 +342,13 @@
|
||||
destination = current + ( speed * speed ) / ( 2 * deceleration ) * ( distance < 0 ? -1 : 1 );
|
||||
duration = speed / deceleration;
|
||||
|
||||
if(speed === 0) {
|
||||
return {
|
||||
destination: current,
|
||||
duration: 0
|
||||
};
|
||||
}
|
||||
|
||||
// Check if the final destination needs to be rubber banded
|
||||
if ( destination < lowerMargin ) {
|
||||
// We have dragged too far down, snap back to the maximum
|
||||
@ -635,6 +648,9 @@
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Trigger a done scrolling event.
|
||||
*/
|
||||
_doneScrolling: function() {
|
||||
this.didStopScrolling && this.didStopScrolling({
|
||||
target: this.el,
|
||||
|
||||
Reference in New Issue
Block a user