diff --git a/client/src/components/drawer/Drawing.tsx b/client/src/components/drawer/Drawing.tsx index cb60ec80..71ff930e 100644 --- a/client/src/components/drawer/Drawing.tsx +++ b/client/src/components/drawer/Drawing.tsx @@ -17,6 +17,7 @@ export default function DrawingTab() { Drawing + ((set, get) => ({ MultiPolygon, setters: { remove, add }, } = get() + const { keepCutoutsOnMerge } = usePersist.getState() + let newPoly: Feature = { geometry: { type: 'MultiPolygon', coordinates: [] }, type: 'Feature', @@ -329,8 +332,14 @@ export const useShapes = create((set, get) => ({ } } }) - if (newPoly.geometry.type === 'Polygon') { - newPoly.geometry.coordinates = [newPoly.geometry.coordinates[0]] + if (!keepCutoutsOnMerge) { + if (newPoly.geometry.type === 'Polygon') { + newPoly.geometry.coordinates = [newPoly.geometry.coordinates[0]] + } else if (newPoly.geometry.type === 'MultiPolygon') { + newPoly.geometry.coordinates = newPoly.geometry.coordinates.map( + (p) => [p[0]], + ) + } } Object.entries( all