Map.addLayer() will return false when adding duplicate layers. Fixes #248.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@2539 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2007-03-08 19:58:20 +00:00
parent 4e5bc0234a
commit a779f0e69a
2 changed files with 20 additions and 0 deletions

View File

@@ -299,6 +299,12 @@ OpenLayers.Map.prototype = {
* @param {OpenLayers.Layer} layer
*/
addLayer: function (layer) {
for(var i=0; i < this.layers.length; i++) {
if (this.layers[i] == layer) {
return false;
}
}
layer.div.style.overflow = "";
this.setLayerZIndex(layer, this.layers.length);