feat(svelte) added onedgecreate function

This commit is contained in:
Peter
2023-11-28 15:48:19 +01:00
parent 1eea7209a3
commit 3f94dfa84c
7 changed files with 34 additions and 6 deletions
@@ -55,6 +55,7 @@
isValidConnection,
lib,
addEdge,
onedgecreate,
panBy,
cancelConnection,
updateConnection,
@@ -80,8 +81,16 @@
cancelConnection,
panBy,
onConnect: (connection) => {
addEdge(connection);
if ($onedgecreate) {
const modifiedConnection = $onedgecreate(connection);
if (modifiedConnection) {
addEdge(modifiedConnection);
dispatch('connect', { connection });
}
return;
}
addEdge(connection);
// @todo: should we change/ improve the stuff we are passing here?
// instead of source/target we could pass fromNodeId, fromHandleId, etc
dispatch('connect', { connection });