Merge branch 'enhance-connection-more' of github.com:xyflow/xyflow into enhance-connection-more

This commit is contained in:
moklick
2024-06-27 17:15:36 +02:00
5 changed files with 36 additions and 20 deletions
+11 -4
View File
@@ -1,4 +1,11 @@
import { pointToRendererPoint, getHostForElement, calcAutoPan, getEventPosition, getHandlePosition } from '../utils';
import {
pointToRendererPoint,
getHostForElement,
calcAutoPan,
getEventPosition,
getHandlePosition,
rendererPointToPoint,
} from '../utils';
import {
ConnectionMode,
Position,
@@ -98,7 +105,7 @@ function onPointerDown(
fromPosition: fromHandle.position,
fromNode: fromNodeInternal.internals.userNode,
to: pointToRendererPoint(position, getTransform()),
to: position,
toHandle: null,
toPosition: oppositePosition[fromHandle.position],
toNode: null,
@@ -151,8 +158,8 @@ function onPointerDown(
isValid,
to:
closestHandle && isValid
? { x: closestHandle.x, y: closestHandle.y }
: pointToRendererPoint(position, transform),
? rendererPointToPoint({ x: closestHandle.x, y: closestHandle.y }, transform)
: position,
toHandle: result.toHandle,
toPosition: isValid && result.toHandle ? result.toHandle.position : oppositePosition[fromHandle.position],
toNode: result.toHandle ? nodeLookup.get(result.toHandle.nodeId)!.internals.userNode : null,