unionOfRects() — react Function Reference
Architecture documentation for the unionOfRects() function in geometry.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 4f0df6ba_57ab_cc88_9a94_1bc63bfad061["unionOfRects()"] 1d481b0c_03e1_6f28_eff1_74d4566b3dc8["geometry.js"] 4f0df6ba_57ab_cc88_9a94_1bc63bfad061 -->|defined in| 1d481b0c_03e1_6f28_eff1_74d4566b3dc8 0d243608_f488_b170_3ab3_3c4450110021["rectToBox()"] 4f0df6ba_57ab_cc88_9a94_1bc63bfad061 -->|calls| 0d243608_f488_b170_3ab3_3c4450110021 ee75b67e_5a11_9c92_ca64_32a3289b3e68["boxToRect()"] 4f0df6ba_57ab_cc88_9a94_1bc63bfad061 -->|calls| ee75b67e_5a11_9c92_ca64_32a3289b3e68 style 4f0df6ba_57ab_cc88_9a94_1bc63bfad061 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-devtools-timeline/src/view-base/geometry.js lines 128–147
export function unionOfRects(...rects: Rect[]): Rect {
if (rects.length === 0) {
return zeroRect;
}
const [firstRect, ...remainingRects] = rects;
const boxUnion = remainingRects
.map(rectToBox)
.reduce((intermediateUnion, nextBox): Box => {
const [unionTop, unionRight, unionBottom, unionLeft] = intermediateUnion;
const [nextTop, nextRight, nextBottom, nextLeft] = nextBox;
return [
Math.min(unionTop, nextTop),
Math.max(unionRight, nextRight),
Math.max(unionBottom, nextBottom),
Math.min(unionLeft, nextLeft),
];
}, rectToBox(firstRect));
return boxToRect(boxUnion);
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does unionOfRects() do?
unionOfRects() is a function in the react codebase, defined in packages/react-devtools-timeline/src/view-base/geometry.js.
Where is unionOfRects() defined?
unionOfRects() is defined in packages/react-devtools-timeline/src/view-base/geometry.js at line 128.
What does unionOfRects() call?
unionOfRects() calls 2 function(s): boxToRect, rectToBox.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free