determine correct handle positions in for connections (#4384)
* determine correct handle positions in for connections * refactor(handle-utils): cleanup * refactor(handle-utils): cleanup --------- Co-authored-by: moklick <info@moritzklack.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { getHandlePosition } from '../utils';
|
||||
import {
|
||||
ConnectionStatus,
|
||||
type HandleType,
|
||||
@@ -16,14 +17,15 @@ export function getHandles(
|
||||
type: HandleType,
|
||||
currentHandle: string
|
||||
): ConnectionHandle[] {
|
||||
return (handleBounds[type] || []).reduce<ConnectionHandle[]>((res, h) => {
|
||||
if (`${node.id}-${h.id}-${type}` !== currentHandle) {
|
||||
return (handleBounds[type] || []).reduce<ConnectionHandle[]>((res, handle) => {
|
||||
if (`${node.id}-${handle.id}-${type}` !== currentHandle) {
|
||||
const [x, y] = getHandlePosition(node, handle);
|
||||
res.push({
|
||||
id: h.id || null,
|
||||
id: handle.id || null,
|
||||
type,
|
||||
nodeId: node.id,
|
||||
x: node.internals.positionAbsolute.x + h.x + h.width / 2,
|
||||
y: node.internals.positionAbsolute.y + h.y + h.height / 2,
|
||||
x,
|
||||
y,
|
||||
});
|
||||
}
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user