do no declare vars multiple times in functions, no functional change

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11517 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-02-25 15:52:48 +00:00
parent 26d8f31c5d
commit fa533001d1

View File

@@ -815,13 +815,13 @@ OpenLayers.Layer = OpenLayers.Class({
// map
// 7. hope for the best!
var i, len;
var i, len, p;
var props = {}, alwaysInRange = true;
// get resolution data from layer config
// (we also set alwaysInRange in the layer as appropriate)
for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
var p = this.RESOLUTION_PROPERTIES[i];
p = this.RESOLUTION_PROPERTIES[i];
props[p] = this.options[p];
if(alwaysInRange && this.options[p]) {
alwaysInRange = false;
@@ -845,7 +845,7 @@ OpenLayers.Layer = OpenLayers.Class({
// in the map
if(props.resolutions == null) {
for(i=0, len=this.RESOLUTION_PROPERTIES.length; i<len; i++) {
var p = this.RESOLUTION_PROPERTIES[i];
p = this.RESOLUTION_PROPERTIES[i];
props[p] = this.options[p] != null ?
this.options[p] : this.map[p];
}
@@ -960,6 +960,8 @@ OpenLayers.Layer = OpenLayers.Class({
*/
calculateResolutions: function(props) {
var viewSize, wRes, hRes;
// determine maxResolution
var maxResolution = props.maxResolution;
if(props.minScale != null) {
@@ -967,9 +969,9 @@ OpenLayers.Layer = OpenLayers.Class({
OpenLayers.Util.getResolutionFromScale(props.minScale,
this.units);
} else if(maxResolution == "auto" && this.maxExtent != null) {
var viewSize = this.map.getSize();
var wRes = this.maxExtent.getWidth() / viewSize.w;
var hRes = this.maxExtent.getHeight() / viewSize.h;
viewSize = this.map.getSize();
wRes = this.maxExtent.getWidth() / viewSize.w;
hRes = this.maxExtent.getHeight() / viewSize.h;
maxResolution = Math.max(wRes, hRes);
}
@@ -980,9 +982,9 @@ OpenLayers.Layer = OpenLayers.Class({
OpenLayers.Util.getResolutionFromScale(props.maxScale,
this.units);
} else if(props.minResolution == "auto" && this.minExtent != null) {
var viewSize = this.map.getSize();
var wRes = this.minExtent.getWidth() / viewSize.w;
var hRes = this.minExtent.getHeight()/ viewSize.h;
viewSize = this.map.getSize();
wRes = this.minExtent.getWidth() / viewSize.w;
hRes = this.minExtent.getHeight()/ viewSize.h;
minResolution = Math.max(wRes, hRes);
}
@@ -1141,14 +1143,14 @@ OpenLayers.Layer = OpenLayers.Class({
* value and the 'closest' specification.
*/
getZoomForResolution: function(resolution, closest) {
var zoom;
var zoom, i, len;
if(this.map.fractionalZoom) {
var lowZoom = 0;
var highZoom = this.resolutions.length - 1;
var highRes = this.resolutions[lowZoom];
var lowRes = this.resolutions[highZoom];
var res;
for(var i=0, len=this.resolutions.length; i<len; ++i) {
for(i=0, len=this.resolutions.length; i<len; ++i) {
res = this.resolutions[i];
if(res >= resolution) {
highRes = res;
@@ -1169,7 +1171,7 @@ OpenLayers.Layer = OpenLayers.Class({
} else {
var diff;
var minDiff = Number.POSITIVE_INFINITY;
for(var i=0, len=this.resolutions.length; i<len; i++) {
for(i=0, len=this.resolutions.length; i<len; i++) {
if (closest) {
diff = Math.abs(this.resolutions[i] - resolution);
if (diff > minDiff) {