textmode.js / layering / TextmodeLayerManager
Class: TextmodeLayerManager
Manages all user-defined layers within a Textmodifier in addition to the base layer.
This manager is responsible for:
- Managing the collection of user layers (add, remove, move, swap)
- Coordinating layer rendering and compositing
The instance of this class can be accessed via Textmodifier.layers.
The base layer is not part of the public layer stack, but is instead managed internally.
Implements
ILayerManager
Accessors
all
Get Signature
get all(): readonly TextmodeLayer[];Get all user layers as a readonly array.
Returns
readonly TextmodeLayer[]
Implementation of
ILayerManager.allbase
Get Signature
get base(): TextmodeLayer;The base layer that is always rendered at the bottom of the layer stack. This layer represents the main drawing content before any user layers are composited.
Returns
Implementation of
ILayerManager.baseMethods
add()
add(options): TextmodeLayer;Add a new layer to the manager.
Parameters
| Parameter | Type | Description |
|---|---|---|
options | TextmodeLayerOptions | Layer configuration options. |
Returns
The newly added layer.
Implementation of
ILayerManager.addclear()
clear(): void;Remove all user-created layers from the manager. The base layer is not affected by this operation. This is useful for integration into live-coding environments where code is re-evaluated and layers need to be recreated from scratch.
Returns
void
Implementation of
ILayerManager.clearmove()
move(layer, newIndex): void;Move a layer to a new index in the layer stack.
Parameters
| Parameter | Type | Description |
|---|---|---|
layer | TextmodeLayer | The layer to move. |
newIndex | number | The new index for the layer. |
Returns
void
Implementation of
ILayerManager.moveremove()
remove(layer): void;Remove a layer from the manager.
Parameters
| Parameter | Type | Description |
|---|---|---|
layer | TextmodeLayer | The layer to remove. |
Returns
void
Implementation of
ILayerManager.removeswap()
swap(layerA, layerB): void;Swap the order of two layers if they exist in the same collection.
Parameters
| Parameter | Type | Description |
|---|---|---|
layerA | TextmodeLayer | The first layer to swap. |
layerB | TextmodeLayer | The second layer to swap. |
Returns
void
Implementation of
ILayerManager.swap