change size to optional
This commit is contained in:
+4
-2
@@ -662,11 +662,13 @@ ol.View.prototype.getResolutions = function() {
|
|||||||
/**
|
/**
|
||||||
* Get the resolution for a provided extent (in map units) and size (in pixels).
|
* Get the resolution for a provided extent (in map units) and size (in pixels).
|
||||||
* @param {ol.Extent} extent Extent.
|
* @param {ol.Extent} extent Extent.
|
||||||
* @param {ol.Size} size Box pixel size.
|
* @param {ol.Size} opt_size Box pixel size.
|
||||||
* @return {number} The resolution at which the provided extent will render at
|
* @return {number} The resolution at which the provided extent will render at
|
||||||
* the given size.
|
* the given size.
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.View.prototype.getResolutionForExtent = function(extent, size) {
|
ol.View.prototype.getResolutionForExtent = function(extent, opt_size) {
|
||||||
|
var size = opt_size || this.getSizeFromViewport_();
|
||||||
var xResolution = ol.extent.getWidth(extent) / size[0];
|
var xResolution = ol.extent.getWidth(extent) / size[0];
|
||||||
var yResolution = ol.extent.getHeight(extent) / size[1];
|
var yResolution = ol.extent.getHeight(extent) / size[1];
|
||||||
return Math.max(xResolution, yResolution);
|
return Math.max(xResolution, yResolution);
|
||||||
|
|||||||
Reference in New Issue
Block a user