Skip to content

Commit 92ba8c1

Browse files
prushforprushfor
authored andcommitted
Fix problem with layer control by adding a method 'addOrUpdateOverlay'
which emulates old leaflet addOverlay behaviour by not adding the layer if it already exists, but it updates the layer name in the legend control.
1 parent df6195f commit 92ba8c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

map-layer.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
this.parentElement._layerControl.removeLayer(this._layer);
142142
} else {
143143
this._layerControl = this.parentElement._layerControl;
144-
this._layerControl.addOverlay(this._layer,this.label);
144+
this._layerControl.addOrUpdateOverlay(this._layer,this.label);
145145
}
146146
this._validateDisabled();
147147
}
@@ -200,7 +200,7 @@
200200
// if controls option is enabled, insert the layer into the overlays array
201201
if (Polymer.dom(this).parentNode.controls && !this.hidden) {
202202
this._layerControl = Polymer.dom(this).parentNode._layerControl;
203-
this._layerControl.addOverlay(this._layer, this.label);
203+
this._layerControl.addOrUpdateOverlay(this._layer, this.label);
204204
}
205205
// toggle the this.disabled attribute depending on whether the layer
206206
// is: same prj as map, within view/zoom of map

0 commit comments

Comments
 (0)