Making it so OpenLayers.Util.getResolutionFromScale returns undefined resolution when given a falsey scale. r=ahocevar (closes #2464, see #2462)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10019 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2010-02-04 17:02:23 +00:00
parent ae73ca0679
commit 37e881bc54
2 changed files with 16 additions and 10 deletions

View File

@@ -1182,18 +1182,19 @@ OpenLayers.Util.normalizeScale = function (scale) {
*
* Returns:
* {Float} The corresponding resolution given passed-in scale and unit
* parameters.
* parameters. If the given scale is falsey, the returned resolution will
* be undefined.
*/
OpenLayers.Util.getResolutionFromScale = function (scale, units) {
if (units == null) {
units = "degrees";
var resolution;
if (scale) {
if (units == null) {
units = "degrees";
}
var normScale = OpenLayers.Util.normalizeScale(scale);
resolution = 1 / (normScale * OpenLayers.INCHES_PER_UNIT[units]
* OpenLayers.DOTS_PER_INCH);
}
var normScale = OpenLayers.Util.normalizeScale(scale);
var resolution = 1 / (normScale * OpenLayers.INCHES_PER_UNIT[units]
* OpenLayers.DOTS_PER_INCH);
return resolution;
};