@jsvision/ui / contains
Function: contains()
contains(
r,p):boolean
Defined in: ui/src/view/geometry.ts:69
Test whether a point lies inside a rect. Bounds are half-open (x ≤ p.x < x + width, y ≤ p.y < y + height), so two edge-adjacent rects never both contain the same cell — handy for hit-testing tiled regions.
Parameters
r
The rect.
p
The point to test.
Returns
boolean
true when p is inside r.
Example
ts
import { contains } from '@jsvision/ui';
const rect = { x: 0, y: 0, width: 4, height: 4 };
contains(rect, { x: 3, y: 3 }); // true
contains(rect, { x: 4, y: 0 }); // false — right edge is exclusive