From 92757b9ad410b58d46104531a75b3378c559c820 Mon Sep 17 00:00:00 2001 From: Christian Mayer Date: Wed, 27 Jun 2018 19:24:16 +0200 Subject: [PATCH] Adapt LayerList according to added / removed layers in map --- src/components/layerlist/LayerList.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/layerlist/LayerList.vue b/src/components/layerlist/LayerList.vue index b2d79d20..f6dacabc 100644 --- a/src/components/layerlist/LayerList.vue +++ b/src/components/layerlist/LayerList.vue @@ -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.