textmode.js / layering / TextmodeLayerManager
Class: TextmodeLayerManager
Manages all user-defined layers within a Textmodifier in addition to the base layer.
Responsibilities:
- Managing the collection of user layers (add, remove, move, swap)
- Coordinating layer rendering and compositing
- Owning the global post-processing pipeline (global filters + present to screen)
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.basefilters
Get Signature
get filters(): TextmodeFilterManager;Returns
resultFramebuffer
Get Signature
get resultFramebuffer(): TextmodeFramebuffer;The framebuffer containing the final composited result after all layers and filters have been applied.
Returns
Implementation of
ILayerManager.resultFramebufferMethods
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 and dispose all user layers (keeps base layer intact).
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