feat(core): add getHandleConnections action (#1595)

* feat(core): add `getHandleConnections` action

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

* chore(changeset): add

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>

---------

Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
Braks
2024-08-30 12:45:11 +02:00
parent 940b08e080
commit 9c003d4353
3 changed files with 14 additions and 1 deletions
+5
View File
@@ -72,6 +72,10 @@ export function useActions(state: State, nodeLookup: ComputedRef<NodeLookup>, ed
return getConnectedEdgesBase(nodesOrId, state.edges)
}
const getHandleConnections: Actions['getHandleConnections'] = ({ id, type, nodeId }) => {
return Array.from(state.connectionLookup.get(`${nodeId}-${type}-${id ?? null}`)?.values() ?? [])
}
const findNode: Actions['findNode'] = (id) => {
if (!id) {
return
@@ -880,6 +884,7 @@ export function useActions(state: State, nodeLookup: ComputedRef<NodeLookup>, ed
getIncomers,
getOutgoers,
getConnectedEdges,
getHandleConnections,
isNodeIntersecting,
panBy,
fitView: (params) => viewportHelper.value.fitView(params),