Interface: Network¶
Imperative controller for a WebGPU network canvas.
Remarks¶
The controller borrows the canvas and device passed to createNetwork; it never removes the canvas or destroys the device. It owns its pointer handlers, render loop, and renderer-created GPU resources. Call Network.destroy before removing the canvas. Load topology before binding channels or reading projection availability.
Properties¶
Methods¶
clearChannel()¶
clearChannel(
channel):void
Clear a previously bound rendering channel.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
Channel name to clear. |
Returns¶
void
clearSelection()¶
clearSelection():
void
Clear selection without emitting a select event.
Returns¶
void
destroy()¶
destroy():
void
Release renderer resources and DOM state without removing the canvas or destroying the device.
Returns¶
void
fadeIn()¶
fadeIn(
ms?):void
Fade the canvas in after the first real frame has painted.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
Transition duration in milliseconds. Default: |
Returns¶
void
fit()¶
fit(
animate?):void
Fit the loaded topology into the current viewport.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
If true, animate toward the fit view when a viewport is available. |
Returns¶
void
load()¶
load(
topology):void
Bind a topology and schedule its first paint.
This method is synchronous; read Network.projections immediately
after it returns. Throws when topology validation or GPU binding fails,
leaving the prior view intact.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
CPU-side graph and geometry arrays. |
Returns¶
void
Throws¶
Error when topology validation or GPU binding fails.
on()¶
on<
K>(event,handler): () =>void
Subscribe to a network event and receive an unsubscribe callback.
Type Parameters¶
Type Parameter |
|---|
|
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
Event name to observe. |
|
|
Callback invoked with the event payload. |
Returns¶
A function that removes the handler.
() => void
panBy()¶
panBy(
dx,dy):void
Pan the active camera by screen pixels.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
Horizontal delta in CSS pixels. |
|
|
Vertical delta in CSS pixels. |
Returns¶
void
pause()¶
pause():
void
Pause animation and rendering until resumed.
Returns¶
void
resume()¶
resume():
void
Resume rendering when the page and GPU device allow it.
Returns¶
void
select()¶
select(
kind,index):void
Programmatically select an item without emitting a select event.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
Item kind to select. |
|
|
Vertex or edge index. |
Returns¶
void
setBaseColor()¶
setBaseColor(
color):void
Set the default vertex color used without a vertexColor channel.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
readonly [ |
RGBA color with normalized channels in |
Returns¶
void
setBorders()¶
setBorders(
borders):void
Replace the optional geographic border overlay.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
Packed border geometry, or |
Returns¶
void
setChannel()¶
setChannel(
channel,values,domain?,range?):void
Bind or replace a per-vertex or per-edge rendering channel.
domain is the input value range. Height channels may also pass an
output range; use null for domain to keep the auto-scanned input range.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
Channel name to bind. |
|
|
|
Scalar values whose length matches the current topology. |
|
readonly [ |
Input domain used for normalization, or |
|
readonly [ |
Output range for |
Returns¶
void
Throws¶
Error when no topology is loaded or the array length is invalid.
setChannelRange()¶
setChannelRange(
channel,range):void
Override the input domain used to normalize a non-dash channel.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
Channel name to update. |
|
|
readonly [ |
Fixed input range, or |
Returns¶
void
setColormap()¶
setColormap(
fn):void
Replace the color lookup table used by colormap channels.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
( |
Function mapping normalized values in |
Returns¶
void
setOptions()¶
setOptions(
options):void
Update display options. msaa remains construction-only.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
Partial display option patch. |
Returns¶
void
setProjection()¶
setProjection(
mode):boolean
Switch projection mode.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
Projection mode to activate. |
Returns¶
boolean
True if the loaded topology supports the mode; false otherwise.
zoomBy()¶
zoomBy(
factor):void
Zoom the active camera around the viewport center.
Parameters¶
Parameter |
Type |
Description |
|---|---|---|
|
|
Multiplicative zoom factor. |
Returns¶
void