Skip to content

DebugModifier

data class DebugModifier(val strs: List<String> = emptyList(), val comps: List<Component> = emptyList()) : Modifier.Element<DebugModifier> 

A Modifier.Element that attaches arbitrary debug information to a composable node.

Debug information is only visible when the debug overlay is active (toggle with Ctrl + Shift while the screen is open). When net.kernelpanicsoft.archie.gui.layout.LayoutNode.extraDebug is enabled (hold Shift in debug mode), the attached strings and components are rendered inside the debug tooltip alongside node dimensions and coordinates.

Multiple DebugModifier elements on the same node are merged by concatenation.

Constructors

DebugModifier

constructor(strs: List<String> = emptyList(), comps: List<Component> = emptyList())

Properties

comps

val comps: List<Component>

strs

val strs: List<String>

Functions

all

open override fun all(predicate: (Modifier.Element<*>) -> Boolean): Boolean

Returns true if predicate returns true for all Elements in this Modifier or if this Modifier contains no Elements.

any

open override fun any(predicate: (Modifier.Element<*>) -> Boolean): Boolean

Returns true if predicate returns true for any Element in this Modifier.

background

@Stable



fun Modifier.background(color: Int): Modifier

Fills the composable's background with a solid ARGB integer color.

@Stable



fun Modifier.background(color: KColor): Modifier

Fills the composable's background with a solid color.

@Stable



fun Modifier.background(startColor: Int, endColor: Int): Modifier

Fills the composable's background with a gradient between two ARGB integer colours.

@Stable



fun Modifier.background(startColor: KColor, endColor: KColor): Modifier

Fills the composable's background with a gradient from startColor to endColor going top-to-bottom.

@Stable



fun Modifier.background(
    startColor: Int, 
    endColor: Int, 
    gradientDirection: GradientDirection = GradientDirection.TOP_TO_BOTTOM
): Modifier

Fills the composable's background with a directional gradient between two ARGB integer colours.

@Stable



fun Modifier.background(
    startColor: KColor, 
    endColor: KColor, 
    gradientDirection: GradientDirection = GradientDirection.TOP_TO_BOTTOM
): Modifier

Fills the composable's background with a gradient from startColor to endColor in the given gradientDirection.

border

@Stable



fun Modifier.border(color: Int, thickness: Int = 1): Modifier

Adds a border using a raw ARGB integer color.

@Stable



fun Modifier.border(color: KColor, thickness: Int = 1): Modifier

Adds a border of thickness pixels and color to the composable.

combinedClickable

@Stable



fun <T : AUINode> Modifier.combinedClickable(
    onLongClick: (T, PointerEvent) -> Unit? = null, 
    onDoubleClick: (T, PointerEvent) -> Unit? = null, 
    onClick: (T, PointerEvent) -> Unit? = null
): Modifier

Adds multiple click-type handlers to a composable in a single modifier.

debug

@Stable



fun Modifier.debug(vararg strs: String): Modifier

Attaches one or more plain-text debug strings to the composable.

The strings are displayed in the debug overlay when debug mode is active.

Parameters

  • strs: The strings to attach.
@Stable



fun Modifier.debug(vararg comps: Component): Modifier

Attaches one or more formatted Component debug labels to the composable.

Parameters

  • comps: The components to attach.

fillMaxHeight

@Stable



fun Modifier.fillMaxHeight(percent: Double = 1.0): Modifier

Forces the node to fill percent of the maximum available height.

Parameters

  • percent: Fraction of available height (0.0–1.0). Default 1.0 fills all available height.

fillMaxSize

@Stable



fun Modifier.fillMaxSize(percent: Double = 1.0): Modifier

Forces the node to fill percent of both the available width and height.

Parameters

  • percent: Fraction of available space (0.0–1.0). Default 1.0 fills all available space.

fillMaxWidth

@Stable



fun Modifier.fillMaxWidth(percent: Double = 1.0): Modifier

Forces the node to fill percent of the maximum available width.

Parameters

  • percent: Fraction of available width (0.0–1.0). Default 1.0 fills all available width.

foldIn

open override fun <R> foldIn(initial: R, operation: (R, Modifier.Element<*>) -> R): R

Accumulates a value starting with initial and applying operation to the current value and each element from outside in.

Elements wrap one another in a chain from left to right; an Element that appears to the left of another in a + expression or in operation's parameter order affects all of the elements that appear after it. foldIn may be used to accumulate a value starting from the parent or head of the modifier chain to the final wrapped child.

foldOut

open override fun <R> foldOut(initial: R, operation: (Modifier.Element<*>, R) -> R): R

Accumulates a value starting with initial and applying operation to the current value and each element from inside out.

Elements wrap one another in a chain from left to right; an Element that appears to the left of another in a + expression or in operation's parameter order affects all of the elements that appear after it. foldOut may be used to accumulate a value starting from the child or tail of the modifier chain up to the parent or head of the chain.

getAll

inline fun <T : Modifier.Element<T>> Modifier.getAll(): List<T>

Collects all Modifier.Element instances of type T from this modifier chain.

Return

A list of all modifier elements matching type T, in declaration order.

height

@Stable



fun Modifier.height(height: Int): Modifier

Sets an exact fixed height of height pixels (width unconstrained).

margin

@Stable



fun Modifier.margin(all: Int = 0): Modifier

Adds a uniform margin on all four sides.

@Stable



fun Modifier.margin(horizontal: Int = 0, vertical: Int = 0): Modifier

Adds symmetric horizontal and vertical margins.

@Stable



fun Modifier.margin(
    left: Int = 0, 
    right: Int = 0, 
    top: Int = 0, 
    bottom: Int = 0
): Modifier

Adds independent per-side margins around this composable.

mergeWith

open override fun mergeWith(other: DebugModifier): DebugModifier

offset

@Stable



fun Modifier.offset(x: Int, y: Int): Modifier

Shifts the composable by (x, y) pixels after layout.

onCharTyped

Registers a character-typed handler on this composable.

onDrag

@Stable



fun <T : AUINode> Modifier.onDrag(global: Boolean = false, onDragEvent: (T, DragEvent) -> Unit): Modifier

Registers a drag event handler on this composable.

onGloballyPositioned

fun Modifier.onGloballyPositioned(onGloballyPositioned: (IntCoordinates) -> Unit): Modifier

onKeyEvent

Registers a key-press handler on this composable.

onPointerEvent

@Stable



fun <T : AUINode> Modifier.onPointerEvent(type: PointerEventType, onEvent: (T, PointerEvent) -> Unit): Modifier

Registers a handler for the given pointer type on this composable.

onScroll

@Stable



fun <T : AUINode> Modifier.onScroll(global: Boolean = false, onScrollEvent: (T, ScrollEvent) -> Unit): Modifier

Registers a scroll event handler on this composable.

onSizeChanged

fun Modifier.onSizeChanged(onSizeChanged: (Size) -> Unit): Modifier

Notifies callback of any size changes to element.

padding

@Stable



fun Modifier.padding(all: Int = 0): Modifier

Adds uniform padding on all four sides.

@Stable



fun Modifier.padding(horizontal: Int = 0, vertical: Int = 0): Modifier

Adds symmetric horizontal and vertical padding.

@Stable



fun Modifier.padding(
    left: Int = 0, 
    right: Int = 0, 
    top: Int = 0, 
    bottom: Int = 0
): Modifier

Adds independent per-side padding inside this composable.

size

@Stable



fun Modifier.size(width: Int, height: Int): Modifier

Sets an exact fixed size of width × height pixels.

@Stable



fun Modifier.size(size: Int): Modifier

Sets an exact fixed square size of size × size pixels.

sizeIn

@Stable



fun Modifier.sizeIn(
    minWidth: Int = 0, 
    maxWidth: Int = Integer.MAX_VALUE, 
    minHeight: Int = 0, 
    maxHeight: Int = Integer.MAX_VALUE
): Modifier

Constrains the node's width and height to be within the given min/max bounds.

Parameters

  • minWidth: Minimum width in pixels.

  • maxWidth: Maximum width in pixels.

  • minHeight: Minimum height in pixels.

  • maxHeight: Maximum height in pixels.

texture

@Stable



fun Modifier.texture(texture: ResourceLocation): Modifier

Overrides the texture of theme-aware composables with the given ResourceLocation.

then

open infix fun then(other: Modifier): Modifier

Concatenates this modifier with another.

Returns a Modifier representing this modifier followed by other in sequence.

toComponent

open override fun toComponent(): Component

Converts this modifier element to a debug Component representation.

toComponents

fun toComponents(): List<Component>

Returns the debug information as a list of individual Components, one per item.

tooltip

@Stable



fun Modifier.tooltip(vararg tooltips: TooltipComponent): Modifier

Attaches one or more TooltipComponents to this composable.

toString

open override fun toString(): String

unsafeMergeWith

open fun unsafeMergeWith(other: Modifier.Element<*>): Self

width

@Stable



fun Modifier.width(width: Int): Modifier

Sets an exact fixed width of width pixels (height unconstrained).

zIndex

@Stable



fun Modifier.zIndex(zIndex: Float): Modifier

Sets the rendering depth of this composable relative to its siblings.