Skip to content

Commit

Permalink
Revert "Add GeoJSON import/export and box selection (#46)" (#47)
Browse files Browse the repository at this point in the history
This reverts commit 1c97e31.
  • Loading branch information
cedbossneo authored Jun 27, 2024
1 parent 1c97e31 commit 8a5f55c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 431 deletions.
17 changes: 3 additions & 14 deletions web/src/components/DrawControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import MapboxDraw from '@mapbox/mapbox-gl-draw';
import type {ControlPosition} from 'react-map-gl';
import {useControl} from 'react-map-gl';
import {useEffect} from "react";
import DirectSelectWithBoxMode from '../modes/DirectSelectWithBoxMode';

type DrawControlProps = ConstructorParameters<typeof MapboxDraw>[0] & {
position?: ControlPosition;
Expand All @@ -13,32 +12,22 @@ type DrawControlProps = ConstructorParameters<typeof MapboxDraw>[0] & {
onUpdate: (evt: any) => void;
onCombine: (evt: any) => void;
onDelete: (evt: any) => void;
onModeChange: (mode: string) => void;
};

export default function DrawControl(props: DrawControlProps) {
const mp = useControl<MapboxDraw>(
() => new MapboxDraw({
...props,
modes: {
...MapboxDraw.modes,
direct_select: DirectSelectWithBoxMode
}
}),
({ map }) => {
() => new MapboxDraw(props),
({map}) => {
map.on('draw.create', props.onCreate);
map.on('draw.update', props.onUpdate);
map.on('draw.combine', props.onCombine);
map.on('draw.delete', props.onDelete);
map.on('draw.modechange', (e) => props.onModeChange(e.mode));

},
({map}) => {
map.off('draw.create', props.onCreate);
map.off('draw.update', props.onUpdate);
map.off('draw.combine', props.onCombine);
map.off('draw.delete', props.onDelete);
map.off('draw.modechange', (e) => props.onModeChange(e.mode));
}
,
{
Expand Down Expand Up @@ -76,4 +65,4 @@ DrawControl.defaultProps = {
},
onCombine: () => {
},
};
};
Loading

0 comments on commit 8a5f55c

Please sign in to comment.