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 dispatch from '../../workers/dispatcher-main';
|
||||||
import { Feature } from 'ol';
|
import { Feature } from 'ol';
|
||||||
import uri from '../../lib/ids';
|
import uri from '../../lib/ids';
|
||||||
|
import { currentGpxId } from '../gpx-dialog';
|
||||||
|
|
||||||
const id = getUri('drawingSelections', undefined);
|
const id = getUri('drawingSelections', undefined);
|
||||||
|
|
||||||
|
@ -61,20 +62,25 @@ const AllNoneCurrent: Component<{}> = (props) => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const gpxSelection = () => drawingSelections().gpxSelection;
|
||||||
|
|
||||||
export const mustBeDrawn = (feature: Feature) => {
|
export const mustBeDrawn = (feature: Feature) => {
|
||||||
const id = feature.getId();
|
const id = feature.getId() as String;
|
||||||
const type = feature.get('type');
|
const type = feature.get('type');
|
||||||
const idObj = uri(type, id);
|
|
||||||
const gpxId = idObj.gpx;
|
|
||||||
console.log({
|
console.log({
|
||||||
caller: 'DrawingSelector / mustBeDrawn',
|
caller: 'DrawingSelector / mustBeDrawn',
|
||||||
feature,
|
feature,
|
||||||
type,
|
type,
|
||||||
id,
|
id,
|
||||||
idObj,
|
currentGpxId: currentGpxId(),
|
||||||
gpxId,
|
gpxSelection: gpxSelection(),
|
||||||
});
|
});
|
||||||
if (drawingSelections().gpxSelection === 'ALL') return true;
|
if (gpxSelection() === 'ALL') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (gpxSelection() === 'CURRENT') {
|
||||||
|
return id.startsWith(currentGpxId());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue