Merge pull request #13464 from ahocevar/projection-warning
Do not warn about coordinates when view projection is configured
This commit is contained in:
+3
-3
@@ -401,15 +401,15 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
this.cancelAnchor_ = undefined;
|
this.cancelAnchor_ = undefined;
|
||||||
|
|
||||||
|
if (options.projection) {
|
||||||
|
disableCoordinateWarning();
|
||||||
|
}
|
||||||
if (options.center) {
|
if (options.center) {
|
||||||
options.center = fromUserCoordinate(options.center, this.projection_);
|
options.center = fromUserCoordinate(options.center, this.projection_);
|
||||||
}
|
}
|
||||||
if (options.extent) {
|
if (options.extent) {
|
||||||
options.extent = fromUserExtent(options.extent, this.projection_);
|
options.extent = fromUserExtent(options.extent, this.projection_);
|
||||||
}
|
}
|
||||||
if (options.projection) {
|
|
||||||
disableCoordinateWarning();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.applyOptions_(options);
|
this.applyOptions_(options);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -620,7 +620,7 @@ export function fromUserCoordinate(coordinate, destProjection) {
|
|||||||
showCoordinateWarning = false;
|
showCoordinateWarning = false;
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.warn(
|
console.warn(
|
||||||
'Call useGeographic() ol/proj once to work with [longitude, latitude] coordinates.'
|
'Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return coordinate;
|
return coordinate;
|
||||||
|
|||||||
@@ -930,5 +930,13 @@ describe('ol/proj.js', function () {
|
|||||||
view.setCenter([15, 47]);
|
view.setCenter([15, 47]);
|
||||||
expect(callCount).to.be(0);
|
expect(callCount).to.be(0);
|
||||||
});
|
});
|
||||||
|
it('is not shown when view projection is configured', function () {
|
||||||
|
const view = new View({
|
||||||
|
projection: 'EPSG:4326',
|
||||||
|
center: [16, 48],
|
||||||
|
});
|
||||||
|
view.setCenter([15, 47]);
|
||||||
|
expect(callCount).to.be(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user