MCPcopy
hub / github.com/xyflow/xyflow / nodeToRect

Function nodeToRect

packages/system/src/utils/general.ts:100–111  ·  view source on GitHub ↗
(node: InternalNodeBase | NodeBase, nodeOrigin: NodeOrigin = [0, 0])

Source from the content-addressed store, hash-verified

98});
99
100export const nodeToRect = (node: InternalNodeBase | NodeBase, nodeOrigin: NodeOrigin = [0, 0]): Rect => {
101 const { x, y } = isInternalNodeBase(node)
102 ? node.internals.positionAbsolute
103 : getNodePositionWithOrigin(node, nodeOrigin);
104
105 return {
106 x,
107 y,
108 width: node.measured?.width ?? node.width ?? node.initialWidth ?? 0,
109 height: node.measured?.height ?? node.height ?? node.initialHeight ?? 0,
110 };
111};
112
113export const nodeToBox = (node: InternalNodeBase | NodeBase, nodeOrigin: NodeOrigin = [0, 0]): Box => {
114 const { x, y } = isInternalNodeBase(node)

Callers 8

getNodeRectFunction · 0.90
useReactFlowFunction · 0.90
getNodesWithinDistanceFunction · 0.90
handleExpandParentFunction · 0.90
updateNodeInternalsFunction · 0.90
getNodesInsideFunction · 0.90
getNodeRectFunction · 0.90
useSvelteFlowFunction · 0.90

Calls 2

isInternalNodeBaseFunction · 0.90

Tested by

no test coverage detected