Skip to content

LayoutNode

class LayoutNode(nodeName: String = "LayoutNode") : Measurable, Placeable, AUINode, MeasureScope

The concrete node type that forms Archie's UI scene graph.

Every composable in the Archie GUI framework ultimately creates one LayoutNode. It handles measurement, draw-chain rendering (including DrawModifier wrapping), z-index sorting, input hit-testing, and the Ctrl+Shift debug overlay.

Do not instantiate directly — use Layout and higher-level composables instead.

Parameters

  • nodeName: A human-readable label shown in the debug overlay for this node.

Constructors

LayoutNode

constructor(nodeName: String = "LayoutNode")

Parameters

  • nodeName: A human-readable label shown in the debug overlay for this node.

Properties

absoluteCoords

Absolute on-screen coordinates, accumulating parent offsets up the scene graph.

children

Mutable list of child LayoutNodes, managed by AUINodeApplier.

debug

var debug: Boolean

Whether the debug overlay is active. Setting this on a child propagates to the root.

drawModifiers

Ordered list of DrawModifiers extracted from modifier.

extraDebug

Whether the extended modifier info is shown in the debug overlay. Setting this propagates to the root.

height

open override var height: Int

The measured height in pixels.

layoutChangingModifiers

Ordered list of LayoutChangingModifiers extracted from modifier.

measurePolicy

open override var measurePolicy: MeasurePolicy

modifier

open override var modifier: Modifier

parent

The parent LayoutNode in the scene graph, or null for root nodes.

processedModifier

Processed modifier map keyed by element type for O(1) lookup.

renderer

open override var renderer: Renderer

rootNode

The topmost ancestor LayoutNode (the root of this subtree).

size

open val size: IntSize

The measured size as an IntSize value.

width

open override var width: Int

The measured width in pixels.

x

open override var x: Int

y

open override var y: Int

zIndex

val zIndex: Float

The effective z-index for this node, used for draw and input ordering.

Functions

get

inline fun <T : Modifier.Element<T>> get(): T?

Retrieves the merged Modifier.Element of type T from processedModifier, or null.

getMaxZ

fun getMaxZ(layerOffset: Float): Float

Computes the maximum effective z-depth in this subtree, adding layerOffset.

isBounded

fun isBounded(mouseX: Int, mouseY: Int): Boolean

Returns true if (mouseX, mouseY) falls within this node's absolute screen bounds.

measure

open override fun measure(constraints: Constraints): Placeable

Measures this node within constraints and returns a Placeable for placement.

Parameters

  • constraints: The size constraints imposed by the parent.

placeAt

open override fun placeAt(x: Int, y: Int)

Places this node at the given screen coordinates.

Parameters

  • x: Absolute x position in screen pixels.

  • y: Absolute y position in screen pixels.

render

open override fun render(
    x: Int, 
    y: Int, 
    guiGraphics: GuiGraphics, 
    mouseX: Int, 
    mouseY: Int, 
    partialTick: Float
)
fun render(
    x: Int, 
    y: Int, 
    guiGraphics: GuiGraphics, 
    mouseX: Int, 
    mouseY: Int, 
    partialTick: Float, 
    zOffset: Float
)

Renders this node and its entire subtree, with z-index translation, draw-modifier wrapping, and the optional debug overlay.

toString

open override fun toString(): String