Correctly prune completed animation series

This commit is contained in:
Tim Schaub
2016-11-10 10:18:42 -07:00
parent 0c54d141cb
commit 97d942c8e2
2 changed files with 38 additions and 3 deletions
+5 -3
View File
@@ -305,7 +305,7 @@ ol.View.prototype.updateAnimations_ = function() {
}
var elapsed = now - animation.start;
var fraction = elapsed / animation.duration;
if (fraction > 1) {
if (fraction >= 1) {
animation.complete = true;
fraction = 1;
} else {
@@ -345,14 +345,16 @@ ol.View.prototype.updateAnimations_ = function() {
}
}
if (seriesComplete) {
this.animations_[i] = null;
this.setHint(ol.View.Hint.ANIMATING, -1);
var completed = this.animations_.pop();
var callback = completed[0].callback;
var callback = series[0].callback;
if (callback) {
callback(true);
}
}
}
// prune completed series
this.animations_ = this.animations_.filter(Boolean);
if (more && this.updateAnimationKey_ === undefined) {
this.updateAnimationKey_ = requestAnimationFrame(this.updateAnimations_);
}