API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classObservableVector
An AbstractVector subclass that notifies an owner whenever its components change. Used internally by Rectangle, `SceneNode`, View and other types to invalidate cached state (normals, transforms) on mutation. Instead of a per-instance callback closure, the vector holds a reference to its `owner` plus a numeric `channel` and calls `owner._onObservableChange(channel)` on change. This keeps hot per-node vectors closure-free — a `SceneNode` carries four of these, so dropping the bound closures saves four allocations per node. Pass `owner = null` for a plain, non-reactive vector. Setting individual components (`x`, `y`) notifies only when the value actually changes. Batch mutations via `set()` notify at most once per call.
import { ObservableVector } from '@codexo/exojs' An AbstractVector subclass that notifies an owner whenever its components change. Used internally by Rectangle, `SceneNode`, View and other types to invalidate cached state (normals, transforms) on mutation.
Instead of a per-instance callback closure, the vector holds a reference to its `owner` plus a numeric `channel` and calls `owner._onObservableChange(channel)` on change. This keeps hot per-node vectors closure-free — a `SceneNode` carries four of these, so dropping the bound closures saves four allocations per node. Pass `owner = null` for a plain, non-reactive vector.
Setting individual components (`x`, `y`) notifies only when the value actually changes. Batch mutations via `set()` notify at most once per call.
new(owner: ObservableVectorOwner | null, channel: number, x: number, y: number): ObservableVector add(x: number, y: number): this clone(): this copy(vector: AbstractVector): this cross(vector: T): number destroy(): void distanceTo(vector: T): number divide(x: number, y: number): this dot(x: number, y: number): number equals(__namedParameters: Partial<T>): boolean invert(): this max(): number min(): number multiply(x: number, y: number): this normalize(): this perp(): this rperp(): this scale(x: number, y: number): this set(x: number, y: number): this subtract(x: number, y: number): this transform(matrix: Matrix): this transformInverse(matrix: Matrix): this angle: number length: number lengthSq: number x: number y: number