# Interface: Network Imperative controller for a WebGPU network canvas. ## Remarks The controller borrows the canvas and device passed to [createNetwork](../index.md#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](#destroy) before removing the canvas. Load topology before binding channels or reading projection availability. ## Properties | Property | Modifier | Type | Description | | :------ | :------ | :------ | :------ | | `projections` | `readonly` | `Readonly`\<\{ `flat`: `boolean`; `globe`: `boolean`; `tilt`: `boolean`; \}\> | Projection modes currently supported by the loaded topology. | ## Methods ### clearChannel() > **clearChannel**(`channel`): `void` Clear a previously bound rendering channel. #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `channel` | [`Channel`](../index.md#channel) | 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 | | :------ | :------ | :------ | | `ms?` | `number` | Transition duration in milliseconds. Default: `150`. | #### Returns `void` *** ### fit() > **fit**(`animate?`): `void` Fit the loaded topology into the current viewport. #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `animate?` | `boolean` | 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 | | :------ | :------ | :------ | | `topology` | [`Topology`](Topology.md) | 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 | | :------ | | `K` *extends* keyof [`Events`](../index.md#events) | #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `event` | `K` | Event name to observe. | | `handler` | [`Events`](../index.md#events)\[`K`\] | 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 | | :------ | :------ | :------ | | `dx` | `number` | Horizontal delta in CSS pixels. | | `dy` | `number` | 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 | | :------ | :------ | :------ | | `kind` | `"vertex"` \| `"edge"` | Item kind to select. | | `index` | `number` | Vertex or edge index. | #### Returns `void` *** ### setBaseColor() > **setBaseColor**(`color`): `void` Set the default vertex color used without a `vertexColor` channel. #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `color` | readonly \[`number`, `number`, `number`, `number`\] | RGBA color with normalized channels in `[0, 1]`. | #### Returns `void` *** ### setBorders() > **setBorders**(`borders`): `void` Replace the optional geographic border overlay. #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `borders` | [`Borders`](Borders.md) \| `null` | Packed border geometry, or `null` to clear borders. | #### 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` | [`Channel`](../index.md#channel) | Channel name to bind. | | `values` | `Float32Array` | Scalar values whose length matches the current topology. | | `domain?` | readonly \[`number`, `number`\] \| `null` | Input domain used for normalization, or `null` for height auto-scan. | | `range?` | readonly \[`number`, `number`\] | Output range for `vertexHeight`; ignored by other channels. | #### 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` | [`Channel`](../index.md#channel) | Channel name to update. | | `range` | readonly \[`number`, `number`\] \| `null` | Fixed input range, or `null` to return to the scanned/default domain. | #### Returns `void` *** ### setColormap() > **setColormap**(`fn`): `void` Replace the color lookup table used by colormap channels. #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `fn` | (`t`) => readonly \[`number`, `number`, `number`\] | Function mapping normalized values in `[0, 1]` to RGB channels in `[0, 1]`. | #### Returns `void` *** ### setOptions() > **setOptions**(`options`): `void` Update display options. `msaa` remains construction-only. #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `options` | [`Options`](Options.md) | Partial display option patch. | #### Returns `void` *** ### setProjection() > **setProjection**(`mode`): `boolean` Switch projection mode. #### Parameters | Parameter | Type | Description | | :------ | :------ | :------ | | `mode` | `"flat"` \| `"tilt"` \| `"globe"` | 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 | | :------ | :------ | :------ | | `factor` | `number` | Multiplicative zoom factor. | #### Returns `void`