Also update zoom property
This commit is contained in:
+3
-4
@@ -480,8 +480,7 @@ class View extends BaseObject {
|
|||||||
);
|
);
|
||||||
if (options.resolution !== undefined) {
|
if (options.resolution !== undefined) {
|
||||||
this.setResolution(options.resolution);
|
this.setResolution(options.resolution);
|
||||||
}
|
} else if (options.zoom !== undefined) {
|
||||||
if (options.zoom !== undefined) {
|
|
||||||
this.setZoom(options.zoom);
|
this.setZoom(options.zoom);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -530,8 +529,7 @@ class View extends BaseObject {
|
|||||||
// preserve resolution (or zoom)
|
// preserve resolution (or zoom)
|
||||||
if (options.resolution !== undefined) {
|
if (options.resolution !== undefined) {
|
||||||
options.resolution = this.getResolution();
|
options.resolution = this.getResolution();
|
||||||
}
|
} else {
|
||||||
if (options.zoom !== undefined) {
|
|
||||||
options.zoom = this.getZoom();
|
options.zoom = this.getZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1731,6 +1729,7 @@ class View extends BaseObject {
|
|||||||
}
|
}
|
||||||
if (this.get(ViewProperty.RESOLUTION) !== newResolution) {
|
if (this.get(ViewProperty.RESOLUTION) !== newResolution) {
|
||||||
this.set(ViewProperty.RESOLUTION, newResolution);
|
this.set(ViewProperty.RESOLUTION, newResolution);
|
||||||
|
this.set('zoom', this.getZoom(), true);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
!newCenter ||
|
!newCenter ||
|
||||||
|
|||||||
@@ -623,11 +623,15 @@ describe('ol/View', function () {
|
|||||||
minZoom: 2,
|
minZoom: 2,
|
||||||
zoom: 10,
|
zoom: 10,
|
||||||
});
|
});
|
||||||
const options = view.getProperties();
|
view.setZoom(8);
|
||||||
|
view.setCenter([1, 2]);
|
||||||
|
view.setRotation(1);
|
||||||
|
|
||||||
expect(options.center).to.eql([0, 0]);
|
const options = view.getProperties();
|
||||||
expect(options.minZoom).to.eql(2);
|
expect(options.minZoom).to.eql(2);
|
||||||
expect(options.zoom).to.eql(10);
|
expect(options.zoom).to.eql(8);
|
||||||
|
expect(options.center).to.eql([1, 2]);
|
||||||
|
expect(options.rotation).to.eql(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('applies the current zoom', function () {
|
it('applies the current zoom', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user