From 12add876037546a01541a2cbe2181a5bc1d308dc Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 4 Dec 2016 15:04:54 -0700 Subject: [PATCH 1/2] Stop asserting that zero duration animations take time --- test/spec/ol/view.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/spec/ol/view.test.js b/test/spec/ol/view.test.js index 8b1bbfb33e..e0616571a6 100644 --- a/test/spec/ol/view.test.js +++ b/test/spec/ol/view.test.js @@ -379,7 +379,6 @@ describe('ol.View', function() { zoom: 4, duration: 0 }); - expect(view.getAnimating()).to.eql(true); setTimeout(function() { expect(view.getCenter()).to.eql([0, 0]); From dfbc7bb74387cb9557a69372383bb9568737526e Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 4 Dec 2016 15:10:53 -0700 Subject: [PATCH 2/2] Stop dividing by zero --- src/ol/view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/view.js b/src/ol/view.js index a491962eef..2cd8b2deed 100644 --- a/src/ol/view.js +++ b/src/ol/view.js @@ -304,7 +304,7 @@ ol.View.prototype.updateAnimations_ = function() { continue; } var elapsed = now - animation.start; - var fraction = elapsed / animation.duration; + var fraction = animation.duration > 0 ? elapsed / animation.duration : 1; if (fraction >= 1) { animation.complete = true; fraction = 1;