chore(svelte/onConnect): cleanup

This commit is contained in:
moklick
2023-11-28 16:50:17 +01:00
parent 3f94dfa84c
commit 1d7803aff7
@@ -80,20 +80,17 @@
updateConnection, updateConnection,
cancelConnection, cancelConnection,
panBy, panBy,
onConnect: (connection) => { onConnect: (_connection) => {
if ($onedgecreate) { let connection = $onedgecreate ? $onedgecreate(_connection) : _connection;
const modifiedConnection = $onedgecreate(connection);
if (modifiedConnection) { if (!connection) {
addEdge(modifiedConnection);
dispatch('connect', { connection });
}
return; return;
} }
addEdge(connection); addEdge(connection);
// @todo: should we change/ improve the stuff we are passing here? // @todo: should we change/ improve the stuff we are passing here?
// instead of source/target we could pass fromNodeId, fromHandleId, etc // instead of source/target we could pass fromNodeId, fromHandleId, etc
dispatch('connect', { connection }); dispatch('connect', { connection: _connection });
}, },
onConnectStart: (event, startParams) => { onConnectStart: (event, startParams) => {
dispatch('connectstart', { dispatch('connectstart', {