View / make the constrainResolution function private

Other classes should not need to worry about constraining the resolution
or not, as the View will eventually do this on its own.
This commit is contained in:
Olivier Guyot
2019-01-10 17:38:37 +01:00
parent 3c1e3779e2
commit e6c4b2ffd1
4 changed files with 27 additions and 40 deletions

View File

@@ -345,13 +345,12 @@ class View extends BaseObject {
if (options.resolution !== undefined) {
this.setResolution(options.resolution);
} else if (options.zoom !== undefined) {
this.setResolution(this.constrainResolution(
this.maxResolution_, options.zoom - this.minZoom_));
if (this.resolutions_) { // in case map zoom is out of min/max zoom range
this.setResolution(clamp(
Number(this.getResolution() || properties[ViewProperty.RESOLUTION]),
const resolution = this.getResolutionForZoom(options.zoom);
this.setResolution(clamp(resolution,
this.minResolution_, this.maxResolution_));
} else {
this.setZoom(options.zoom);
}
}