chore(svelte): use on:connect in custom node

This commit is contained in:
moklick
2023-08-21 18:12:29 +02:00
parent 208ee5b944
commit 8614297650
2 changed files with 23 additions and 5 deletions
@@ -10,7 +10,8 @@
Position,
type Node,
type NodeTypes,
type Edge
type Edge,
type Connection
} from '../../lib/index';
import { CustomNode } from './CustomNode';
@@ -102,9 +103,20 @@
animated: true
}
]);
const onConnect = (connection: Connection) => {
console.log('on connect', connection);
};
</script>
<SvelteFlow {nodes} {edges} {nodeTypes} style="--bgcolor: {$bgColor}" fitView>
<SvelteFlow
{nodes}
{edges}
{nodeTypes}
style="--bgcolor: {$bgColor}"
fitView
on:connect={onConnect}
>
<Controls />
<Background variant={BackgroundVariant.Dots} />
<MiniMap />