Skip to main content

getFloatingEdgeParams

Computes floating connection points between two nodes from their geometry.

import { getFloatingEdgeParams } from "@tisoap/react-flow-smart-edge";

const { sx, sy, tx, ty, sourcePos, targetPos } = getFloatingEdgeParams(
sourceNode,
targetNode,
);

Return value

FieldDescription
sx, sySource intersection coordinates
tx, tyTarget intersection coordinates
sourcePos, targetPosSide of each node (Position)

Feed these into getSmartEdge when building a custom floating edge. Both nodes need absolute positions and measured dimensions.

  • getNodeIntersection — intersection point for one node
  • getEdgePosition — which side of a node an intersection lies on

See Floating edges.