Cleanup (remove the tree/branch mechanism which isn't useful).
This commit is contained in:
1 parent
38224d73da
commit
21a63ec54c
5 files changed
+5
-59
No files matched your search
@@ -1,20 +1,12 @@
|
||||
import {
|
||||
Component,
|
||||
createEffect,
|
||||
createResource,
|
||||
createSignal,
|
||||
onCleanup,
|
||||
} from 'solid-js';
|
||||
import { Component, createEffect, createSignal, onCleanup } from 'solid-js';
|
||||
|
||||
import dispatch, { cancelDispatch } from '../../workers/dispatcher-main';
|
||||
import VectorSource from 'ol/source/Vector';
|
||||
import GeoJSON from 'ol/format/GeoJSON';
|
||||
import { setBranch, tree } from '../map';
|
||||
import { Feature } from 'ol';
|
||||
import { useI18n } from '@solid-primitives/i18n';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import Dialog from '../dialog';
|
||||
import { Box, Button, Grid, Stack, TextField } from '@suid/material';
|
||||
import { Box, Button, Stack, TextField } from '@suid/material';
|
||||
|
||||
interface Props {
|
||||
wptId: string;
|
||||
@@ -85,7 +77,7 @@ export const Wpt: Component<Props> = ({ vectorSource, wptId: wptId }) => {
|
||||
createEffect(() => {
|
||||
console.log({ caller: 'Wpt', vectorSource, wptId, wpt: cloneDeep(wpt()) });
|
||||
|
||||
if (wpt() /* && !tree[wptId] */) {
|
||||
if (wpt()) {
|
||||
const existingFeature = vectorSource.getFeatureById(wptId);
|
||||
if (existingFeature) {
|
||||
vectorSource.removeFeature(existingFeature);
|
||||
@@ -108,17 +100,9 @@ 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 });
|
||||
}
|
||||
});
|
||||
|
||||
const updateHandler = (feature: Feature) => {
|
||||
console.log({
|
||||
caller: 'Wpt / updateHandler / clicked',
|
||||
feature,
|
||||
});
|
||||
};
|
||||
|
||||
const closeHandler = () => {
|
||||
setMode(Mode.CLOSED);
|
||||
};
|
||||
@@ -129,10 +113,6 @@ export const Wpt: Component<Props> = ({ vectorSource, wptId: wptId }) => {
|
||||
wptId,
|
||||
editedWpt: editedWpt(),
|
||||
});
|
||||
// const newWpt = wpt();
|
||||
// if (newWpt) {
|
||||
// newWpt.name = name.value;
|
||||
// }
|
||||
dispatch({ action: 'putWpt', params: { id: wptId, wpt: editedWpt() } });
|
||||
setMode(Mode.CLOSED);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user