Scene
Defined in: core/scene.ts:351
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Scene(
tolerance?):Scene
Defined in: core/scene.ts:354
Parameters
Section titled “Parameters”tolerance?
Section titled “tolerance?”number = 0.25
Returns
Section titled “Returns”Scene
Methods
Section titled “Methods”appendedBuffers()
Section titled “appendedBuffers()”appendedBuffers(
name,fromDrawable):GroupBufferDelta
Defined in: core/scene.ts:714
GPU-ready buffers for ONLY the drawables appended at/after fromDrawable —
the tail slices as O(1) views (pointCenters assembled in O(new circles)). A
backend whose buffers mirror the group 1:1 (append-only, same order) can apply
this by appending: the index values are group-ABSOLUTE (no rebasing), because
the new vertices sit at the same positions the group placed them.
fromDrawable >= drawableCount yields an empty delta.
Parameters
Section titled “Parameters”string
fromDrawable
Section titled “fromDrawable”number
Returns
Section titled “Returns”appendToGroup()
Section titled “appendToGroup()”appendToGroup(
name,build):void
Defined in: core/scene.ts:374
Append more drawables to an existing group (vs group(), which replaces it). New drawables’ integer drawableIds continue after the existing ones; a duplicate domain id (the caller’s string/number id) throws. NOTE: not atomic across a multi-drawable build — if a later drawable in the batch throws, earlier ones are already committed. Callers needing all-or-nothing (the engine append path) validate ids before calling.
Parameters
Section titled “Parameters”string
(g) => void
Returns
Section titled “Returns”void
buffers()
Section titled “buffers()”buffers(
name):GroupBuffers
Defined in: core/scene.ts:687
Assemble GPU-ready typed arrays for a group. O(1) views of the typed storage for
everything except pointCenters (assembled fresh, O(pointCount) — it interleaves
the drawableId per circle). See GroupBuffers for the sharing contract.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”declutterIndex()
Section titled “declutterIndex()”declutterIndex(
name):DeclutterIndex
Defined in: core/scene.ts:578
The DeclutterIndex for a group — the transform-independent anchor grouping used by
screen-space declutter. Built once and cached on the group; the per-frame caller projects
ax/ay to screen and bins them, so the (string-keyed) grouping never re-runs on a zoom.
Invalidated automatically when the group is rebuilt (group) or appended to
(appendToGroup).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”DeclutterIndex
drawableCount()
Section titled “drawableCount()”drawableCount(
name):number
Defined in: core/scene.ts:381
Number of drawables currently registered in a group.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number
drawableOf()
Section titled “drawableOf()”drawableOf(
name,id):DrawableVector|null
Defined in: core/scene.ts:661
The vector view of ONE drawable by domain id, or null when the id has no drawable (unknown, or culled at build time). O(1) lookup.
Parameters
Section titled “Parameters”string
string | number
Returns
Section titled “Returns”DrawableVector | null
drawables()
Section titled “drawables()”drawables(
name,from?):DrawableVector[]
Defined in: core/scene.ts:652
Return the vector view of a group’s drawables, optionally only those at/after
from (so an incremental append can read just the new ones in O(new)).
Parameters
Section titled “Parameters”string
number = 0
Returns
Section titled “Returns”flagsView()
Section titled “flagsView()”flagsView(
name):Uint8Array
Defined in: core/scene.ts:628
A LIVE typed view of a group’s per-drawable flag bytes (bit 0 = visible): the SAME
Uint8Array instance across calls — zero per-call allocation — aliasing the Scene’s
typed flags storage directly (#207 made #208’s mirror the primary storage), so the
flag writers (setFlag, writeDeclutterFlags) are visible through it
with no double-write. Replaced only when the drawable set changes (append grows it;
a group rebuild replaces it). This is what the flags-only per-frame path (#208)
passes by reference to Backend.updateLayerFlags, instead of the
O(9·drawableCount)-bytes styleTables snapshot. Callers must treat it as
read-only and must not retain it across drawable-set changes.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”Uint8Array
group()
Section titled “group()”group(
name,build):void
Defined in: core/scene.ts:357
Build (or rebuild) a named group. The callback registers drawables.
Parameters
Section titled “Parameters”string
(g) => void
Returns
Section titled “Returns”void
range()
Section titled “range()”range(
name,id):DrawableRange
Defined in: core/scene.ts:537
The contiguous buffer slice a drawable occupies.
Parameters
Section titled “Parameters”string
string | number
Returns
Section titled “Returns”remove()
Section titled “remove()”remove(
name):void
Defined in: core/scene.ts:364
Drop a group entirely (vs an empty re-group, which keeps a zero-drawable entry).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
setFill()
Section titled “setFill()”setFill(
name,id,color):void
Defined in: core/scene.ts:553
Set a drawable’s fill color (any CSS color string). Hot-swappable.
Parameters
Section titled “Parameters”string
string | number
string
Returns
Section titled “Returns”void
setFlag()
Section titled “setFlag()”setFlag(
name,id,flags):void
Defined in: core/scene.ts:566
Set a drawable’s flag byte (e.g. bit 0 = visible). Hot-swappable. Writes the typed storage directly, so any flagsView/styleTables view sees it.
Parameters
Section titled “Parameters”string
string | number
number
Returns
Section titled “Returns”void
setStroke()
Section titled “setStroke()”setStroke(
name,id,color):void
Defined in: core/scene.ts:559
Set a drawable’s stroke color (any CSS color string). Hot-swappable.
Parameters
Section titled “Parameters”string
string | number
string
Returns
Section titled “Returns”void
styleTables()
Section titled “styleTables()”styleTables(
name):StyleTables
Defined in: core/scene.ts:675
The per-drawable color/flag tables (see StyleTables) as LIVE views of the
group’s typed storage — O(1), zero copies (#207; previously an O(drawableCount)
snapshot per call). Later setFill/setStroke/setFlag writes are visible through
the views; an append makes them stale (backends always receive the drawable-set
change as a setLayers/updateLayer/appendToLayer first). Consumers must not mutate
or retain them across drawable-set changes.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”writeDeclutterFlags()
Section titled “writeDeclutterFlags()”writeDeclutterFlags(
name,visibleByGroup):void
Defined in: core/scene.ts:606
Apply a per-anchor-group visibility verdict (1 = keep, 0 = hide) to the flag bytes, in
place — one linear pass over the cached DeclutterIndex, with no per-id Map lookups.
Drawables with no anchor (groupOf = -1) always stay visible. visibleByGroup is indexed
by the same group index as ax/ay. Writes the typed flags storage directly — the
flagsView the per-frame path hands to backends aliases it (#208).
Parameters
Section titled “Parameters”string
visibleByGroup
Section titled “visibleByGroup”Uint8Array
Returns
Section titled “Returns”void