public sealed interface ResizePolicy
Defines how resizing interactions are applied and handled for SubspaceModifier.resizable.
Members
Companion
public companion object
Properties
Default
public val Default: ResizePolicy = system()
The default system-handled resize policy.
Functions
system
public fun system(onResize: ((SpatialResizeEvent) -> Unit)? = null): ResizePolicy
Resize policy where the system automatically handles the resize gesture and applies the new dimensions to the content under the hood. This policy will not update the layout size of the object inside its parent. For instance, if used on an object inside a androidx.xr.compose.subspace.SpatialRow, the object size will change but the row size will not, potentially resulting in 3D object overlaps, unless the object is also paired with a movable modifier. Removing a modifier using this policy will reset the user resize state, causing the object to revert to its layout size.
Parameters
| onResize | Optional observer callback invoked during the interaction to monitor resize events. Since the system automatically applies the resize, this callback is strictly for monitoring changes and should not be used to update the content size. |
custom
public fun custom(onResize: (SpatialResizeEvent) -> Unit): ResizePolicy
Custom resizing policy where the developer is fully responsible for applying the new dimensions to the content (e.g., by updating a state that backs width/height). This is necessary for situations where the overall layout should be readjusted after the resize event. Using this policy has higher latency than system.
Parameters
| onResize | Callback invoked during the interaction containing the calculated target size. |