Skip to content

Commit 23f6034

Browse files
authored
[Bug] Prevent dragging legend component outside of container (#2885)
Signed-off-by: Ritesh9876 <[email protected]>
1 parent d549fcd commit 23f6034

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/components/src/map/map-legend-panel.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {withState} from '../injector';
2424
import MapControlPanelFactory from './map-control-panel';
2525
import MapControlTooltipFactory from './map-control-tooltip';
2626
import MapLegendFactory from './map-legend';
27+
import {restrictToWindowEdges} from '@dnd-kit/modifiers';
2728

2829
const DRAG_RESIZE_ID = 'map-legend-resize';
2930
const DRAG_MOVE_ID = 'map-legend-move';
@@ -203,6 +204,7 @@ const DraggableLegend = withState(
203204
onDragStart={handleDragStart}
204205
onDragMove={handleDragMove}
205206
onDragEnd={handleDragEnd}
207+
modifiers={[restrictToWindowEdges]}
206208
>
207209
<DraggableLegendContent
208210
ref={legendContentRef}

0 commit comments

Comments
 (0)