diff --git a/src/components/drawing-selector/DrawingSelector.tsx b/src/components/drawing-selector/DrawingSelector.tsx index 651e071..06fe127 100644 --- a/src/components/drawing-selector/DrawingSelector.tsx +++ b/src/components/drawing-selector/DrawingSelector.tsx @@ -9,6 +9,7 @@ import { getDrawingSelections } from '../../db/drawing-selections'; import dispatch from '../../workers/dispatcher-main'; import { Feature } from 'ol'; import uri from '../../lib/ids'; +import { currentGpxId } from '../gpx-dialog'; const id = getUri('drawingSelections', undefined); @@ -61,20 +62,25 @@ const AllNoneCurrent: Component<{}> = (props) => { ); }; +const gpxSelection = () => drawingSelections().gpxSelection; + export const mustBeDrawn = (feature: Feature) => { - const id = feature.getId(); + const id = feature.getId() as String; const type = feature.get('type'); - const idObj = uri(type, id); - const gpxId = idObj.gpx; console.log({ caller: 'DrawingSelector / mustBeDrawn', feature, type, id, - idObj, - gpxId, + currentGpxId: currentGpxId(), + gpxSelection: gpxSelection(), }); - if (drawingSelections().gpxSelection === 'ALL') return true; + if (gpxSelection() === 'ALL') { + return true; + } + if (gpxSelection() === 'CURRENT') { + return id.startsWith(currentGpxId()); + } return false; };