diff --git a/src/ol/View.js b/src/ol/View.js index 34adb308d7..2fcd51bc33 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -339,7 +339,7 @@ View.prototype.animate = function(var_args) { animation.callback = callback; // check if animation is a no-op - if (View.isNoopAnimation(animation)) { + if (isNoopAnimation(animation)) { animation.complete = true; // we still push it onto the series for callback handling } else { @@ -1204,7 +1204,7 @@ export function createRotationConstraint(options) { * @param {ol.ViewAnimation} animation The animation. * @return {boolean} The animation involves no view change. */ -View.isNoopAnimation = function(animation) { +export function isNoopAnimation(animation) { if (animation.sourceCenter && animation.targetCenter) { if (!coordinatesEqual(animation.sourceCenter, animation.targetCenter)) { return false; @@ -1217,5 +1217,6 @@ View.isNoopAnimation = function(animation) { return false; } return true; -}; +} + export default View; diff --git a/test/spec/ol/view.test.js b/test/spec/ol/view.test.js index c024db66b0..321c69667c 100644 --- a/test/spec/ol/view.test.js +++ b/test/spec/ol/view.test.js @@ -1,5 +1,8 @@ import Map from '../../../src/ol/Map.js'; -import View, {createCenterConstraint, createResolutionConstraint, createRotationConstraint} from '../../../src/ol/View.js'; +import View, { + createCenterConstraint, createResolutionConstraint, createRotationConstraint, + isNoopAnimation +} from '../../../src/ol/View.js'; import ViewHint from '../../../src/ol/ViewHint.js'; import {createEmpty} from '../../../src/ol/extent.js'; import Circle from '../../../src/ol/geom/Circle.js'; @@ -1485,7 +1488,7 @@ describe('ol.View.isNoopAnimation()', function() { cases.forEach(function(c, i) { it('works for case ' + i, function() { - const noop = View.isNoopAnimation(c.animation); + const noop = isNoopAnimation(c.animation); expect(noop).to.equal(c.noop); }); });