making the layerswitcher a little smarter. Instead of fancy 'noEvent' parameters, we just keep track of the state at each redraw. When asked to redraw, we then check first to see if anything has changed before going ahead with the redraw. Also in this patch, we add a 'visibilitychanged' event to the layer's events object -- upon request by users. (Closes #878)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@4229 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
euzuro
2007-09-12 04:00:31 +00:00
parent 7a37ed4423
commit 0e8e7ab620
5 changed files with 78 additions and 16 deletions

View File

@@ -660,9 +660,8 @@ OpenLayers.Map = OpenLayers.Class({
*
* Parameters:
* newBaseLayer - {<OpenLayers.Layer>}
* noEvent - {Boolean}
*/
setBaseLayer: function(newBaseLayer, noEvent) {
setBaseLayer: function(newBaseLayer) {
var oldExtent = null;
if(this.baseLayer) {
oldExtent = this.baseLayer.getExtent();
@@ -675,7 +674,7 @@ OpenLayers.Map = OpenLayers.Class({
// make the old base layer invisible
if (this.baseLayer != null) {
this.baseLayer.setVisibility(false, noEvent);
this.baseLayer.setVisibility(false);
}
// set new baselayer and make it visible
@@ -701,9 +700,7 @@ OpenLayers.Map = OpenLayers.Class({
}
}
if ((noEvent == null) || (noEvent == false)) {
this.events.triggerEvent("changebaselayer");
}
this.events.triggerEvent("changebaselayer");
}
}
},