comparison client/src/store/map.js @ 3261:916d4c898f08

client: import stretches: prevent map/identify popup from opening when selecting a distance mark on the map
author Markus Kottlaender <markus@intevation.de>
date Tue, 14 May 2019 20:08:10 +0200
parents 985bc5009115
children 5746497085b6
comparison
equal deleted inserted replaced
3260:909a19e97db9 3261:916d4c898f08
31 return { 31 return {
32 openLayersMaps: [], 32 openLayersMaps: [],
33 syncedMaps: [], 33 syncedMaps: [],
34 syncedView: null, 34 syncedView: null,
35 mapPopup: null, 35 mapPopup: null,
36 mapPopupEnabled: true,
36 initialLoad: true, 37 initialLoad: true,
37 extent: { 38 extent: {
38 lat: 6155376, 39 lat: 6155376,
39 lon: 1819178, 40 lon: 1819178,
40 zoom: 11 41 zoom: 11
88 syncedView: (state, view) => { 89 syncedView: (state, view) => {
89 state.syncedView = view; 90 state.syncedView = view;
90 }, 91 },
91 mapPopup: (state, popup) => { 92 mapPopup: (state, popup) => {
92 state.mapPopup = popup; 93 state.mapPopup = popup;
94 },
95 mapPopupEnabled: (state, enabled) => {
96 state.mapPopupEnabled = enabled;
93 }, 97 },
94 setIdentifiedFeatures: (state, identifiedFeatures) => { 98 setIdentifiedFeatures: (state, identifiedFeatures) => {
95 state.identifiedFeatures = identifiedFeatures; 99 state.identifiedFeatures = identifiedFeatures;
96 }, 100 },
97 addIdentifiedFeatures: (state, identifiedFeatures) => { 101 addIdentifiedFeatures: (state, identifiedFeatures) => {
334 // Decide whether we open a related dialog immediately or show the 338 // Decide whether we open a related dialog immediately or show the
335 // popup with possible options first. 339 // popup with possible options first.
336 // The following cases require a manual decision via the popup because 340 // The following cases require a manual decision via the popup because
337 // the targeted feature is not clear. 341 // the targeted feature is not clear.
338 if ( 342 if (
339 bottlenecks.length || 343 (bottlenecks.length ||
340 gauges.length > 1 || 344 gauges.length > 1 ||
341 stretches.length > 1 || 345 stretches.length > 1 ||
342 sections.length > 1 || 346 sections.length > 1 ||
343 (sections.length && stretches.length) || 347 (sections.length && stretches.length) ||
344 (gauges.length && sections.length) || 348 (gauges.length && sections.length) ||
345 (gauges.length && stretches.length) 349 (gauges.length && stretches.length)) &&
350 state.mapPopupEnabled
346 ) { 351 ) {
347 state.mapPopup.setMap(map); 352 state.mapPopup.setMap(map);
348 state.mapPopup.setPosition(event.coordinate); 353 state.mapPopup.setPosition(event.coordinate);
349 } 354 }
350 // The following scenarios lead to a distinct action without popup. 355 // The following scenarios lead to a distinct action without popup.