Merge pull request #13101 from M393/view-set-center-undefined
Fix View set center to undefined
This commit is contained in:
@@ -1738,6 +1738,7 @@ class View extends BaseObject {
|
|||||||
this.set(ViewProperty.RESOLUTION, newResolution);
|
this.set(ViewProperty.RESOLUTION, newResolution);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
!newCenter ||
|
||||||
!this.get(ViewProperty.CENTER) ||
|
!this.get(ViewProperty.CENTER) ||
|
||||||
!equals(this.get(ViewProperty.CENTER), newCenter)
|
!equals(this.get(ViewProperty.CENTER), newCenter)
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -562,6 +562,17 @@ describe('ol/View', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#setCenter()', function () {
|
||||||
|
it('allows setting undefined center', function () {
|
||||||
|
const view = new View({
|
||||||
|
center: [0, 0],
|
||||||
|
resolution: 1,
|
||||||
|
});
|
||||||
|
view.setCenter(undefined);
|
||||||
|
expect(view.getCenter()).to.be(undefined);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('#setHint()', function () {
|
describe('#setHint()', function () {
|
||||||
it('changes a view hint', function () {
|
it('changes a view hint', function () {
|
||||||
const view = new View({
|
const view = new View({
|
||||||
|
|||||||
Reference in New Issue
Block a user