API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classRectangle
Mutable axis-aligned rectangle defined by a top-left origin `(x, y)` and dimensions `(width, height)`. Implements Collidable with full SAT collision response for rectangles and polygons, and specialised algorithms for circle and ellipse intersections. `Rectangle.temp` is a shared scratch instance. Edge normals are lazily computed and cached; they are invalidated when position or size mutates. Position and size are reactive components, so EVERY mutation - the accessors here, `set`/`copy`, and a write one level down such as `rect.size.width = 5` - funnels through a single internal notification. Pass `onChange` to be told about all of them: an owner that hands out its live rectangle uses it to run whatever invalidation a direct write implies - a camera's viewport rectangle bumps the camera's update counter this way. clone deliberately does not carry the callback over - a copy is a value, not a second owner. See ReadonlyRectangle for the read-only view engine APIs hand out when they return a live internal rectangle.
import { Rectangle } from '@codexo/exojs'Mutable axis-aligned rectangle defined by a top-left origin `(x, y)` and dimensions `(width, height)`. Implements Collidable with full SAT collision response for rectangles and polygons, and specialised algorithms for circle and ellipse intersections.
`Rectangle.temp` is a shared scratch instance. Edge normals are lazily computed and cached; they are invalidated when position or size mutates.
Position and size are reactive components, so EVERY mutation - the accessors here, `set`/`copy`, and a write one level down such as `rect.size.width = 5` - funnels through a single internal notification. Pass `onChange` to be told about all of them: an owner that hands out its live rectangle uses it to run whatever invalidation a direct write implies - a camera's viewport rectangle bumps the camera's update counter this way. clone deliberately does not carry the callback over - a copy is a value, not a second owner.
See ReadonlyRectangle for the read-only view engine APIs hand out when they return a live internal rectangle.
new(x: number, y: number, width: number, height: number, onChange: () => void | null): Rectangleclone(): thiscollidesWith(target: CollidableContract for objects that participate in collision detection. Implemented by all concrete shape classes as well as `SceneNode`.): CollisionResponseResult of a successful Collidable.collidesWith call. Contains the two participating shapes, the penetration depth, containment flags, and the minimum-translati… | nullcontains(x: number, y: number): booleancontainsRect(rect: Rectangle): booleancopy(rectangle: Rectangle): thisdestroy(): voidequals(__namedParameters: Partial<Rectangle>): booleangetBounds(out?: Rectangle): Rectangleproject(axis: VectorConcrete mutable 2D vector with full AbstractVector arithmetic and Collidable collision support (treated as a point collider). `Vector.temp` provides a shared…, result: IntervalA closed scalar interval `[min, max]` used by the SAT collision solver to represent the projection of a shape onto a separating axis. `Interval.temp` provides…): IntervalA closed scalar interval `[min, max]` used by the SAT collision solver to represent the projection of a shape onto a separating axis. `Interval.temp` provides…set(x: number, y: number, width: number, height: number): thissetPosition(x: number, y: number): thissetSize(width: number, height: number): thistransform(matrix: MatrixMutable 3×3 row-major affine transformation matrix used throughout the rendering and physics pipeline. Layout (row, column): ``` | a b x | | c d y | | e f z |…, result: Rectangle): Rectanglebottom: numberheight: numberleft: numberposition: AbstractVectorright: numbertop: numberwidth: numberx: numbery: numbertemp: Rectangle