fix(edges): make it possible to change edge type dynamically closes #3386

This commit is contained in:
moklick
2023-09-14 18:13:33 +02:00
parent 43a3755fd9
commit bd6f774de6
2 changed files with 18 additions and 3 deletions
@@ -113,6 +113,21 @@
);
}
function updateEdge() {
edges.update((eds) =>
eds.map((edge) => {
if (edge.id === '1-2') {
return {
...edge,
type: edge.type === 'default' ? 'smoothstep' : 'default'
};
}
return edge;
})
);
}
$: {
console.log('nodes changed', $nodes);
}
@@ -147,6 +162,7 @@
<MiniMap />
<Panel position="top-right">
<button on:click={updateNode}>update node pos</button>
<button on:click={updateEdge}>update edge type</button>
</Panel>
</SvelteFlow>