Skip to content

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

[Bug] Prevent dragging legend component outside of container (#2885)

Ritesh Mangdare23f603428216
diff --git a/src/components/src/map/map-legend-panel.tsx b/src/components/src/map/map-legend-panel.tsx
index 69c45c58a..587ad4960 100644
--- a/src/components/src/map/map-legend-panel.tsx
+++ b/src/components/src/map/map-legend-panel.tsx
@@ -24,6 +24,7 @@ import {withState} from '../injector';
import MapControlPanelFactory from './map-control-panel';
import MapControlTooltipFactory from './map-control-tooltip';
import MapLegendFactory from './map-legend';
+import {restrictToWindowEdges} from '@dnd-kit/modifiers';
const DRAG_RESIZE_ID = 'map-legend-resize';
const DRAG_MOVE_ID = 'map-legend-move';
@@ -203,6 +204,7 @@ const DraggableLegend = withState(
onDragStart={handleDragStart}
onDragMove={handleDragMove}
onDragEnd={handleDragEnd}
+ modifiers={[restrictToWindowEdges]}
>
<DraggableLegendContent
ref={legendContentRef}