Modifier: chainable, immutable, and read in declaration order.
SpatialWindow(
key = "nav",
modifier = WindowModifier
.size(96.dp, 400.dp)
.anchor(WindowAnchor.Start)
.offset(z = OffsetStep.Near)
) { NavUI() }
val NavStart = WindowModifier.size(96.dp, 400.dp).anchor(WindowAnchor.Start)
Window(key = "nav", modifier = NavStart) { NavUI() }
size(96.dp, 400.dp) for size(120.dp, 400.dp) after a state change) issues a single relayout of the window when the recomposition commits. State changes inside the window's content composable do not relayout the window — they only recompose the content within the existing window. Resize and reposition cost is therefore tied to changes in the modifier chain itself, not to UI state inside the window. Creation-only settings available in narrower API tiers require the window to be removed and recreated.
@Immutable interface WindowModifier
foldIn
(
initial
, operation
)
|
Accumulates operation over every element in this chain, outer elements first.
Signature
abstract fun <R> foldIn(initial: R, operation: (R, WindowModifier.Element) -> R): R Parameters initial: WindowModifieroperation: (R, WindowModifier.Element) -> RReturns WindowModifier |
then
(
other
)
|
Concatenates this modifier with other. Elements in other take precedence.
Signature
open infix fun then(other: WindowModifier): WindowModifier Parameters other: WindowModifierReturns WindowModifier |
anchor
(
anchor
)
|
Attaches the window to the given WindowAnchor. Later entries override earlier ones.
Signature
fun WindowModifier.anchor(anchor: WindowAnchor): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters anchor: WindowAnchorReturns WindowModifier |
height
(
height
)
|
Sets the window height in dp without changing its width. Pass WindowDefaults.MatchParent to match the full parent height, or use WindowModifier.matchParentHeight for fractional parent sizing. If no earlier modifier sets the width, the SDK's default width of 256.dp is retained.
Signature
fun WindowModifier.height(height: Dp): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters height: DpReturns WindowModifier |
matchParentHeight
(
fraction
)
|
Sets the window height to fraction of the parent panel's measured pixel height without changing its width. fraction must be greater than 0f and at most 1f; the default 1f matches the full parent height.
Signature
fun WindowModifier.matchParentHeight(fraction: Float = 1.0f): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters fraction: FloatReturns WindowModifier |
matchParentWidth
(
fraction
)
|
Sets the window width to fraction of the parent panel's measured pixel width without changing its height. fraction must be greater than 0f and at most 1f; the default 1f matches the full parent width.
Signature
fun WindowModifier.matchParentWidth(fraction: Float = 1.0f): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters fraction: FloatReturns WindowModifier |
offset
(
offset
)
|
Translates the window by a pre-built WindowOffset.
Signature
fun WindowModifier.offset(offset: WindowOffset): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters offset: WindowOffsetReturns WindowModifier |
offset
(
x
, y
, z
)
|
Translates the window after anchoring by the given discrete OffsetSteps.
Later entries override earlier ones — each call replaces the full offset.
Signature
fun WindowModifier.offset(
x: OffsetStep = OffsetStep.None,
y: OffsetStep = OffsetStep.None,
z: OffsetStep = OffsetStep.None,
): WindowModifierExtension declared in metavrx.layout.window.compose.layoutParameters x: OffsetStepy: OffsetStepz: OffsetStepReturns WindowModifier |
size
(
size
)
|
Sets the window size. Each dimension may use WindowDefaults.MatchParent to match the parent panel on that axis. Later size or per-axis modifiers override the dimensions they set.
Signature
fun WindowModifier.size(size: WindowSize): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters size: WindowSizeReturns WindowModifier |
size
(
width
, height
)
|
Sets the window width and height in dp. Either dimension may be WindowDefaults.MatchParent. Later size or per-axis modifiers override the dimensions they set.
Signature
fun WindowModifier.size(width: Dp, height: Dp): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters width: Dpheight: DpReturns WindowModifier |
width
(
width
)
|
Sets the window width in dp without changing its height. Pass WindowDefaults.MatchParent to match the full parent width, or use WindowModifier.matchParentWidth for fractional parent sizing. If no earlier modifier sets the height, the SDK's default height of 256.dp is retained.
Signature
fun WindowModifier.width(width: Dp): WindowModifier Extension declared in metavrx.layout.window.compose.layoutParameters width: DpReturns WindowModifier |
foldIn
(
initial
, operation
)
|
Accumulates operation over every element in this chain, outer elements first.
Signature
open override fun <R> foldIn(initial: R, operation: (R, WindowModifier.Element) -> R): R Parameters initial: WindowModifier.Companionoperation: (R, WindowModifier.Element) -> RReturns WindowModifier.Companion |
then
(
other
)
|
Concatenates this modifier with other. Elements in other take precedence.
Signature
open infix override fun then(other: WindowModifier): WindowModifier Parameters other: WindowModifierReturns WindowModifier |
interface Element : WindowModifier
foldIn
(
initial
, operation
)
|
Accumulates operation over every element in this chain, outer elements first.
Signature
open override fun <R> foldIn(initial: R, operation: (R, WindowModifier.Element) -> R): R Parameters initial: WindowModifier.Elementoperation: (R, WindowModifier.Element) -> RReturns WindowModifier.Element |
then
(
other
)
|
Concatenates this modifier with other. Elements in other take precedence.
Signature
open infix fun then(other: WindowModifier): WindowModifier Parameters other: WindowModifierReturns WindowModifier |