Displaying only the current GPX if required
This commit is contained in:
parent
a297c1ec29
commit
b025c74d99
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue