Mercurial > gemma
changeset 3069:766384d0ed7a
client: identify tool: removed distinct enable flag, identify is enabled as long as no other tools are active
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Wed, 17 Apr 2019 10:11:40 +0200 |
parents | 492c30ca3142 |
children | a54216a0193d |
files | client/src/store/map.js |
diffstat | 1 files changed, 7 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/store/map.js Wed Apr 17 09:46:03 2019 +0200 +++ b/client/src/store/map.js Wed Apr 17 10:11:40 2019 +0200 @@ -37,7 +37,6 @@ lon: 1819178, zoom: 11 }, - identifyToolEnabled: true, // event binding (singleclick, dblclick) identifiedFeatures: [], // map features identified by clicking on the map currentMeasurement: null, // distance or area from line-/polygon-/cutTool lineToolEnabled: false, @@ -81,9 +80,6 @@ syncedView: (state, view) => { state.syncedView = view; }, - identifyToolEnabled: (state, enabled) => { - state.identifyToolEnabled = enabled; - }, setIdentifiedFeatures: (state, identifiedFeatures) => { state.identifiedFeatures = identifiedFeatures; }, @@ -218,7 +214,6 @@ cutTool.set("id", "cuttool"); cutTool.setActive(false); cutTool.on("drawstart", () => { - commit("identifyToolEnabled", false); state.openLayersMaps.forEach(m => { m.getLayer("CUTTOOL") .getSource() @@ -227,12 +222,7 @@ }); cutTool.on("drawend", event => { commit("fairwayprofile/selectedCut", null, { root: true }); - dispatch("fairwayprofile/cut", event.feature, { root: true }).then(() => - // This setTimeout is an ugly workaround. If we would enable the - // identifyTool here immediately then the click event from ending the - // cut will trigger it. We don't want that. - setTimeout(() => commit("identifyToolEnabled", true), 1000) - ); + dispatch("fairwayprofile/cut", event.feature, { root: true }); }); map.addInteraction(lineTool); @@ -290,7 +280,12 @@ }, initIdentifyTool({ state, rootState, commit, dispatch }, map) { map.on(["singleclick", "dblclick"], event => { - if (!state.identifyToolEnabled) return; + if ( + state.lineToolEnabled || + state.polygonToolEnabled || + state.cutToolEnabled + ) + return; commit("setIdentifiedFeatures", []); // checking our WFS layers var features = map.getFeaturesAtPixel(event.pixel, { hitTolerance: 7 });