Saving Wpt after edition.
This commit is contained in:
parent
156fefae3b
commit
b36ad82b61
|
@ -83,9 +83,13 @@ export const Wpt: Component<Props> = ({ vectorSource, wptId: wptId }) => {
|
|||
};
|
||||
|
||||
createEffect(() => {
|
||||
console.log({ caller: 'Wpt', vectorSource, wptId, wpt: wpt() });
|
||||
console.log({ caller: 'Wpt', vectorSource, wptId, wpt: cloneDeep(wpt()) });
|
||||
|
||||
if (wpt() && !tree[wptId]) {
|
||||
if (wpt() /* && !tree[wptId] */) {
|
||||
const existingFeature = vectorSource.getFeatureById(wptId);
|
||||
if (existingFeature) {
|
||||
vectorSource.removeFeature(existingFeature);
|
||||
}
|
||||
let geo: any = {
|
||||
type: 'FeatureCollection',
|
||||
features: [
|
||||
|
@ -96,6 +100,7 @@ export const Wpt: Component<Props> = ({ vectorSource, wptId: wptId }) => {
|
|||
coordinates: [wpt()?.$.lon, wpt()?.$.lat],
|
||||
},
|
||||
properties: { type: 'wpt', ...wpt(), id: wptId, getTitle, edit },
|
||||
id: wptId,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
@ -103,7 +108,7 @@ export const Wpt: Component<Props> = ({ vectorSource, wptId: wptId }) => {
|
|||
const features = new GeoJSON().readFeatures(geo);
|
||||
console.log({ caller: 'Wpt', features });
|
||||
vectorSource.addFeatures(features);
|
||||
setBranch(wptId, { features, updateHandler });
|
||||
// setBranch(wptId, { features, updateHandler });
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue