Skip to content

Commit

Permalink
Merge pull request #21 from chrismayer/20-dyn-layerlist
Browse files Browse the repository at this point in the history
Adapt LayerList according to added / removed layers in map
  • Loading branch information
chrismayer authored Jun 28, 2018
2 parents 8a67eea + 92757b9 commit 5c120db
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/layerlist/LayerList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@
* This function is executed, after the map is bound (see mixins/Mapable)
*/
onMapBound () {
this.createLayerItems();
var me = this;
me.createLayerItems();
// react on added / removed layers
me.map.getLayers().on('change:length', function (evt) {
me.createLayerItems();
});
},
/**
* Creates the layer items from the OpenLayers map.
Expand Down

0 comments on commit 5c120db

Please sign in to comment.