# HG changeset patch # User Markus Kottlaender # Date 1555488700 -7200 # Node ID 766384d0ed7ae58aee8e265d950a169b45696344 # Parent 492c30ca31420ec38b53fd36c4d54c6f71528be6 client: identify tool: removed distinct enable flag, identify is enabled as long as no other tools are active diff -r 492c30ca3142 -r 766384d0ed7a client/src/store/map.js --- 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 });