Merge pull request #6863 from cs09g/cs09g-patch-1

change size to optional
This commit is contained in:
Andreas Hocevar
2017-05-31 13:37:52 +02:00
committed by GitHub

View File

@@ -662,11 +662,13 @@ ol.View.prototype.getResolutions = function() {
/**
* Get the resolution for a provided extent (in map units) and size (in pixels).
* @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
* 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 yResolution = ol.extent.getHeight(extent) / size[1];
return Math.max(xResolution, yResolution);