Add some tweaks to hide the add-poi-marker when a layer is enabled

This commit is contained in:
Pieter Vander Vennet 2020-09-17 23:53:57 +02:00
parent 77e065d6e7
commit 15f816e172
5 changed files with 30 additions and 8 deletions

View file

@ -15,6 +15,16 @@ export class StrayClickHandler {
this._uiToShow = uiToShow;
const self = this;
const map = State.state.bm.map;
State.state.filteredLayers.data.forEach((filteredLayer) => {
filteredLayer.isDisplayed.addCallback(isEnabled => {
if(isEnabled){
// When a layer is activated, we remove the 'last click location' in order to force the user to reclick
// This reclick might be at a location where a feature now appeared...
map.removeLayer(self._lastMarker);
}
})
})
State.state.bm.LastClickLocation.addCallback(function (lastClick) {
State.state.selectedElement.setData(undefined);