Ticket #937: patch-#937-r5350-A0.diff
| File patch-#937-r5350-A0.diff, 4.1 kB (added by pgiraud, 1 year ago) |
|---|
-
lib/OpenLayers/Layer.js
old new 359 359 if (this.map) { 360 360 361 361 // min/max Range may have changed 362 this. inRange = this.calculateInRange();362 this.calculateInRange(); 363 363 364 364 // map's center might not yet be set 365 365 var extent = this.getExtent(); … … 415 415 this.initResolutions(); 416 416 417 417 if (!this.isBaseLayer) { 418 this. inRange = this.calculateInRange();418 this.calculateInRange(); 419 419 var show = ((this.visibility) && (this.inRange)); 420 420 this.div.style.display = show ? "" : "none"; 421 421 } … … 531 531 532 532 /** 533 533 * Method: calculateInRange 534 * Checks if layer is layer minResolution and maxResolution matches the 535 * current map resolution, and sets inRange property. 536 * If inRange value changes, also triggers the changelayer map event 537 * and shows/hides the layer if not in range 534 538 * 535 539 * Returns: 536 540 * {Boolean} The layer is displayable at the current map's current 537 541 * resolution. 538 542 */ 539 543 calculateInRange: function() { 540 var inRange = false;544 var prevInRange = this.inRange; 541 545 if (this.map) { 542 546 var resolution = this.map.getResolution(); 543 inRange = ( (resolution >= this.minResolution) &&547 this.inRange = ( (resolution >= this.minResolution) && 544 548 (resolution <= this.maxResolution) ); 549 } else { 550 this.inRange = false; 545 551 } 546 return inRange; 552 // if inRange value changes, trigger changerlayer event, 553 // and show/hide the layer (ie. change div element display) 554 if (prevInRange != this.inRange) { 555 this.map.events.triggerEvent("changelayer"); 556 this.display(this.inRange); 557 } 547 558 }, 548 559 549 560 /** -
lib/OpenLayers/Map.js
old new 1152 1152 for (var i = 0; i < this.layers.length; i++) { 1153 1153 var layer = this.layers[i]; 1154 1154 if (!layer.isBaseLayer) { 1155 1156 var moveLayer; 1157 var inRange = layer.calculateInRange(); 1158 if (layer.inRange != inRange) { 1159 // Layer property has changed. We are going 1160 // to call moveLayer so that the layer can be turned 1161 // off or on. 1162 layer.inRange = inRange; 1163 moveLayer = true; 1164 this.events.triggerEvent("changelayer"); 1165 } else { 1166 // If nothing has changed, then we only move the layer 1167 // if it is visible and inrange. 1168 moveLayer = (layer.visibility && layer.inRange); 1169 } 1170 1171 if (moveLayer) { 1155 // we only move the layer if it is visible and inrange. 1156 layer.calculateInRange(); 1157 if (layer.visibility && layer.inRange) { 1172 1158 layer.moveTo(bounds, zoomChanged, dragging); 1173 1159 } 1174 1160 } -
lib/OpenLayers/Layer/WFS.js
old new 209 209 var outOfBounds = (!firstRendering && 210 210 !this.tile.bounds.containsBounds(bounds)); 211 211 212 if ( (zoomChanged || firstRendering || (!dragging && outOfBounds)) 213 && this.inRange) { 212 if (zoomChanged || firstRendering || (!dragging && outOfBounds)) { 214 213 //determine new tile bounds 215 214 var center = bounds.getCenterLonLat(); 216 215 var tileWidth = bounds.getWidth() * this.ratio;
