Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[fix] Only open either the mapDraw dropdown or locale dropdown (#3056)

Indranil Halder7d601f1104d0
diff --git a/src/reducers/src/ui-state-updaters.ts b/src/reducers/src/ui-state-updaters.ts
index e4f18e422..a6c827fca 100644
--- a/src/reducers/src/ui-state-updaters.ts
+++ b/src/reducers/src/ui-state-updaters.ts
@@ -379,6 +379,15 @@ export const toggleMapControlUpdater = (
? MAP_CONTROLS.effect
: null;
+ // To to toggle the mapDraw and mapLocal dropdowns
+ // We have to deactivate the other active dropdown
+ const dropdownToDeactivate =
+ panelId === MAP_CONTROLS.mapDraw
+ ? MAP_CONTROLS.mapLocale
+ : panelId === MAP_CONTROLS.mapLocale
+ ? MAP_CONTROLS.mapDraw
+ : null;
+
// If we need to deactivate a competing panel and it's currently active
if (panelToDeactivate && state.mapControls[panelToDeactivate]?.active) {
updatedState = {
@@ -393,6 +402,20 @@ export const toggleMapControlUpdater = (
};
}
+ // If we need to deactivate a competing dropdown and it's currently active
+ if (dropdownToDeactivate && state.mapControls[dropdownToDeactivate]?.active) {
+ updatedState = {
+ ...state,
+ mapControls: {
+ ...updatedState.mapControls,
+ [dropdownToDeactivate]: {
+ ...updatedState.mapControls[dropdownToDeactivate],
+ active: false
+ }
+ }
+ };
+ }
+
return {
...updatedState,
mapControls: {