Add view.getZoomForResolution()
This commit is contained in:
@@ -659,8 +659,22 @@ ol.View.prototype.getState = function() {
|
||||
ol.View.prototype.getZoom = function() {
|
||||
var zoom;
|
||||
var resolution = this.getResolution();
|
||||
if (resolution !== undefined &&
|
||||
resolution >= this.minResolution_ && resolution <= this.maxResolution_) {
|
||||
if (resolution !== undefined) {
|
||||
zoom = this.getZoomForResolution(resolution);
|
||||
}
|
||||
return zoom;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Get the zoom level for a resolution.
|
||||
* @param {number} resolution The resolution.
|
||||
* @return {number|undefined} The zoom level for the provided resolution.
|
||||
* @api
|
||||
*/
|
||||
ol.View.prototype.getZoomForResolution = function(resolution) {
|
||||
var zoom;
|
||||
if (resolution >= this.minResolution_ && resolution <= this.maxResolution_) {
|
||||
var offset = this.minZoom_ || 0;
|
||||
var max, zoomFactor;
|
||||
if (this.resolutions_) {
|
||||
|
||||
Reference in New Issue
Block a user