LayoutCoordinates
interface LayoutCoordinates
androidx.compose.ui.layout.LayoutCoordinates |
A holder of the measured bounds for the layout (MeasureBox).
Summary
Public methods | |
---|---|
abstract operator Int |
get(alignmentLine: AlignmentLine) Returns the position in pixels of an alignment line, or AlignmentLine.Unspecified if the line is not provided. |
abstract Rect |
localBoundingBoxOf(sourceCoordinates: LayoutCoordinates, clipBounds: Boolean = true) Returns the bounding box of sourceCoordinates in the local coordinates. |
abstract Offset |
localPositionOf(sourceCoordinates: LayoutCoordinates, relativeToSource: Offset) Converts an relativeToSource in sourceCoordinates space into local coordinates. |
abstract Offset |
localToRoot(relativeToLocal: Offset) Converts a local position within this layout into an offset from the root composable. |
abstract Offset |
localToWindow(relativeToLocal: Offset) Converts relativeToLocal position within this layout into an Offset relative to the window's origin. |
abstract Offset |
windowToLocal(relativeToWindow: Offset) Converts relativeToWindow relative to the window's origin into an Offset relative to this layout. |
Extension functions | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
From androidx.compose.ui.layout
|
Properties | |
---|---|
abstract Boolean |
Returns false if the corresponding layout was detached from the hierarchy. |
abstract LayoutCoordinates? |
The coordinates of the parent layout modifier or parent layout if there is no
parent layout modifier, or |
abstract LayoutCoordinates? |
The coordinates of the parent layout. |
abstract Set<AlignmentLine> |
The alignment lines provided for this layout, not including inherited lines. |
abstract IntSize |
The size of this layout in the local coordinates space. |
Public methods
get
abstract operator fun get(alignmentLine: AlignmentLine): Int
Returns the position in pixels of an alignment line, or AlignmentLine.Unspecified if the line is not provided.
localBoundingBoxOf
abstract fun localBoundingBoxOf(
sourceCoordinates: LayoutCoordinates,
clipBounds: Boolean = true
): Rect
Returns the bounding box of sourceCoordinates in the local coordinates.
If clipBounds is true
, any clipping that occurs between sourceCoordinates and
this layout will affect the returned bounds, and can even result in an empty rectangle
if clipped regions do not overlap. If clipBounds is false, the bounding box of
sourceCoordinates will be converted to local coordinates irrespective of any clipping
applied between the layouts.
When rotation or scaling is applied, the bounding box of the rotated or scaled value will be computed in the local coordinates. For example, if a 40 pixels x 20 pixel layout is rotated 90 degrees, the bounding box will be 20 pixels x 40 pixels in its parent's coordinates.
localPositionOf
abstract fun localPositionOf(
sourceCoordinates: LayoutCoordinates,
relativeToSource: Offset
): Offset
Converts an relativeToSource in sourceCoordinates space into local coordinates. sourceCoordinates may be any LayoutCoordinates that belong to the same compose layout hierarchy.
localToRoot
abstract fun localToRoot(relativeToLocal: Offset): Offset
Converts a local position within this layout into an offset from the root composable.
localToWindow
abstract fun localToWindow(