- From: Chris Shank via GitHub <noreply@w3.org>
- Date: Sat, 05 Jul 2025 22:17:12 +0000
- To: public-fxtf-archive@w3.org
Some additional utilities that could be helpful
- `area(rect: DOMRectInit): number` return the area of the rectangle
- `center(rect: DOMRectInit): DOMPoint` returns the center point of the rect
- `bounds(...rect: DOMRectInit[]): DOMRectReadonly returns a new DOM rect that bounds a list of rects
- `nearestPointOnRect(a DOMRectInit, point: DOMPointInit): DOMPoint` returns the nearest point on the perimeter of the rectangle
- `hitDetection(a DOMRectInit, b DOMRectInit): Hit` returns AABB hit detection between two rects
```ts
type Hit = {
/** The point of contact between the two objects. */
pos: DOMPoint;
/** The a vector representing the overlap between the two objects. */
delta: DOMPoint;
/** The surface normal at the point of contact. */
normal: DOMPoint;
};
```
-
[EGUI's rect utilities](https://docs.rs/egui/latest/egui/struct.Rect.html) could be a helpful reference for other utilities.
--
GitHub Notification of comment by ChrisShank
Please view or discuss this issue at https://github.com/w3c/fxtf-drafts/issues/602#issuecomment-3040335202 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 5 July 2025 22:17:13 UTC