chore(svelte-examples) made examples more svelty

This commit is contained in:
Peter
2023-09-20 13:06:59 +02:00
parent 3eb9c12c20
commit 4dd231a3c9
@@ -110,33 +110,13 @@
]);
function updateNode() {
nodes.update((nds) =>
nds.map((n) => {
if (n.id === '1') {
return {
...n,
position: { x: n.position.x + 20, y: n.position.y }
};
}
return n;
})
);
$nodes[0].position.x += 20;
$nodes = $nodes;
}
function updateEdge() {
edges.update((eds) =>
eds.map((edge) => {
if (edge.id === '1-2') {
return {
...edge,
type: edge.type === 'default' ? 'smoothstep' : 'default'
};
}
return edge;
})
);
$edges[0].type = $edges[0].type === 'default' ? 'smoothstep' : 'default';
$edges = $edges;
}
$: {