Displaying only the current GPX if required

This commit is contained in:
Eric van der Vlist 2023-08-05 17:38:08 +02:00
parent a297c1ec29
commit b025c74d99
1 changed files with 12 additions and 6 deletions

View File

@ -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;
};