move handleEdgeSelection into store, fix hooks

This commit is contained in:
peterkogo
2024-12-18 16:20:37 +01:00
parent 988a0cb7d7
commit 19e233af2d
10 changed files with 66 additions and 63 deletions
@@ -5,7 +5,6 @@
import { getMarkerId } from '@xyflow/system';
import { BezierEdgeInternal } from '$lib/components/edges';
import { useHandleEdgeSelect } from '$lib/hooks/useHandleEdgeSelect';
import type { EdgeLayouted, Edge, EdgeEvents } from '$lib/types';
import type { SvelteFlowStore } from '$lib/store/types';
@@ -61,13 +60,11 @@
markerEnd ? `url('#${getMarkerId(markerEnd, store.flowId)}')` : undefined
);
const handleEdgeSelect = useHandleEdgeSelect();
function onclick(event: MouseEvent | TouchEvent) {
const edge = store.edgeLookup.get(id);
if (edge) {
handleEdgeSelect(id);
store.handleEdgeSelection(id);
onedgeclick?.({ event, edge });
}
}