feat: Assign default handle id and allow for actual loose connections

* When set to loose allow connections from all handles, this requires ids on handles so a default will be set if none provided
This commit is contained in:
Braks
2022-04-11 11:30:10 +02:00
parent ec0f3ef0e4
commit 158be8a515
4 changed files with 29 additions and 12 deletions
+2 -1
View File
@@ -37,9 +37,10 @@ export const getHandle = (bounds: HandleElement[] = [], handleId?: string | null
// there is no handleId when there are no multiple handles/ handles with ids
// so we just pick the first one
let handle
if (bounds.length === 1 ?? !handleId) handle = bounds[0]
if (!handleId && bounds.length === 1) handle = bounds[0]
else if (handleId) handle = bounds.find((d) => d.id === handleId)
console.log(handleId, handle, bounds)
return handle
}