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);
|
||||
}
|
||||
if (
|
||||
!newCenter ||
|
||||
!this.get(ViewProperty.CENTER) ||
|
||||
!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 () {
|
||||
it('changes a view hint', function () {
|
||||
const view = new View({
|
||||
|
||||
Reference in New Issue
Block a user