From: Christopher Schmidt Date: Sat, 26 Apr 2008 16:15:45 +0000 (+0000) Subject: Don't load things if the layer is already visible: if that's the case, we should... X-Git-Tag: live~7699^2~13 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/3d6b28b6662a37ee10491fcd739f7ccdaf56f8db Don't load things if the layer is already visible: if that's the case, we should already be loading. --- diff --git a/public/openlayers/OpenStreetMap.js b/public/openlayers/OpenStreetMap.js index 244930866..f472d3fc1 100644 --- a/public/openlayers/OpenStreetMap.js +++ b/public/openlayers/OpenStreetMap.js @@ -185,9 +185,10 @@ OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, { OpenLayers.Layer.Data = OpenLayers.Class(OpenLayers.Layer, { setVisibility: function(vis) { + var oldvis = this.visibility; OpenLayers.Layer.prototype.setVisibility.apply(this, arguments); if (!this.map) { return; } - if (vis) { + if (vis && !oldvis) { new Ajax.Request('/browse/start', {asynchronous:true, evalScripts:true}); } else { if (this.stopBrowse) {