createOverlay.system#removeLayer¶
Summary¶
createOverlay.system#removeLayer detaches and unregisters a layer by ID. Missing IDs are ignored, so repeated removal attempts are safe. Removal does not destroy the layer; built-in layers can be added again later. The method invalidates overlay state after removal.
Syntax¶
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | Unique layer ID assigned by the layer's id property. |
Returns¶
OverlaySystem - The same overlay system instance.
Example¶
const canvas = document.querySelector("canvas");
const wgpu = await WasmGPU.create(canvas);
const overlay = wgpu.createOverlay.system();
const grid = wgpu.createOverlay.grid({ id: "analysis-grid" });
overlay.addLayer(grid);
overlay.removeLayer("analysis-grid");