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. Deliberately has no `clone()`. A clone is a value, not a second notification channel into this vector's owner, so it would have to hand back a plain `Vector` - and importing `Vector` here closes a module-evaluation cycle (`Vector` imports `Rectangle`, which constructs at module scope). Copy explicitly instead: `new Vector(v.x, v.y)`.
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.
Deliberately has no `clone()`. A clone is a value, not a second notification channel into this vector's owner, so it would have to hand back a plain `Vector` - and importing `Vector` here closes a module-evaluation cycle (`Vector` imports `Rectangle`, which constructs at module scope). Copy explicitly instead: `new Vector(v.x, v.y)`.
add(x: number, y: number): thiscopy(vector: AbstractVector): thiscross(vector: T): numberdestroy(): voiddistanceTo(vector: T): numberdivide(x: number, y: number): thisdot(x: number, y: number): numberequals(__namedParameters: Partial<T>): booleaninvert(): thismax(): numbermin(): numbermultiply(x: number, y: number): thisnormalize(): thisperp(): thisrperp(): thisscale(x: number, y: number): thisset(x: number, y: number): thissubtract(x: number, y: number): thisangle: numberlength: numberlengthSq: numberx: numbery: number