Named exports from ol/View
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user