class Opal::UI::LayerStack

Overview

Manages a depth-ordered stack of Layer surfaces. Composites layers in sorted z-index order onto a target buffer, ensuring overlays, floating windows, dropdowns, and notifications render with correct depth, transparency, and clipping.

Defined in:

opal/ui/layer_stack.cr

Constant Summary

TIER_BACKGROUND = 0

Standard semantic z-index tier constants

TIER_CONTENT = 100
TIER_CURSOR = 1000
TIER_MODALS = 800
TIER_OVERLAYS = 500
TIER_TOASTS = 900
TIER_WINDOWS = 200

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def add(layer : Layer) : Layer #

Adds an existing layer to the stack.


[View source]
def bring_to_front(layer : Layer) : self #

Elevates a layer above all other layers currently in its tier.


[View source]
def clear : self #

Clears all registered layers from the stack.


[View source]
def compose(target : Buffer) : Nil #

Composites all visible layers onto the target buffer in ascending z-index order.


[View source]
def create_layer(width : Int32, height : Int32, z_index : Int32 = TIER_CONTENT, x : Int32 = 0, y : Int32 = 0, transparent_bg : Bool = true) : Layer #

Factory method to create, configure, and register a new layer.


[View source]
def layers : Array(Layer) #

[View source]
def remove(layer : Layer) : Bool #

Removes a layer from the stack.


[View source]
def send_to_back(layer : Layer) : self #

Lowers a layer below all other layers in the stack.


[View source]