RelativeLayoutBounds
-
Cmn
class RelativeLayoutBounds
Represents an axis-aligned bounding Rectangle for an element in a compose hierarchy, in the coordinates of either the Root of the compose hierarchy, the Window, or the Screen.
| See also | |
|---|---|
onLayoutRectChanged |
Summary
Public functions |
||
|---|---|---|
List<IntRect> |
At the current state of the layout, calculates which other Composable Layouts are occluding the Composable associated with this |
Cmn
|
open operator Boolean |
Cmn
|
|
Float |
fractionVisibleIn(viewport: RelativeLayoutBounds)Used to determine the fraction of pixels that are inside the bounds of the |
Cmn
|
Float |
fractionVisibleInRect(left: Int, top: Int, right: Int, bottom: Int)Used to determine the fraction of pixels that are inside the provided rectangle. |
Cmn
|
Float |
Used to determine the fraction of pixels that are inside the bounds of the window. |
Cmn
|
Float |
fractionVisibleInWindowWithInsets(Used to determine the fraction of pixels that are inside the rectangle defined by the window with the provided insets subtracted. |
Cmn
|
open Int |
hashCode() |
Cmn
|
Public properties |
||
|---|---|---|
IntRect |
The positioned bounding Rect in the coordinates of the root node of the compose hierarchy. |
Cmn
|
IntRect |
The positioned bounding Rect in the coordinates of the Screen which it is contained in. |
Cmn
|
IntRect |
The positioned bounding Rect in the coordinates of the Window which it is contained in. |
Cmn
|
Int |
The height, in pixels, of the Rect |
Cmn
|
IntOffset |
The top left position of the Rect in the coordinates of the root node of the compose hierarchy. |
Cmn
|
IntOffset |
The top left position of the Rect in the coordinates of the Screen it is contained in. |
Cmn
|
IntOffset |
The top left position of the Rect in the coordinates of the Window it is contained in |
Cmn
|
Int |
The width, in pixels, of the Rect |
Cmn
|
Public functions
calculateOcclusions
fun calculateOcclusions(): List<IntRect>
At the current state of the layout, calculates which other Composable Layouts are occluding the Composable associated with this RelativeLayoutBounds. Note: Calling this method during measure or layout may result on calculations with stale (or partially stale) layout information.
An occlusion is defined by an intersecting Composable that may draw on top of the target Composable.
There's no guarantee that something was actually drawn to occlude, so a transparent Composable that could otherwise draw on top of the target is considered to be occluding.
There's no differentiation between partial and complete occlusions, they are all included as part of this calculation.
Ancestors, child and grandchild Layouts are never considered to be occluding.
fractionVisibleIn
fun fractionVisibleIn(viewport: RelativeLayoutBounds): Float
Used to determine the fraction of pixels that are inside the bounds of the viewport.
If the viewport is entirely contained inside of the bounds, this method will return 1f. Otherwise, this will return the fraction of pixels of this element that are contained inside the viewport bounds.
fractionVisibleInRect
fun fractionVisibleInRect(left: Int, top: Int, right: Int, bottom: Int): Float
Used to determine the fraction of pixels that are inside the provided rectangle.
If the rectangle is entirely contained inside of the bounds, this method will return 1f. Otherwise, this will return the fraction of pixels of this element that are contained inside the rectangle.
fractionVisibleInWindow
fun fractionVisibleInWindow(): Float
Used to determine the fraction of pixels that are inside the bounds of the window.
If the window is entirely contained inside of the bounds, this method will return 1f. Otherwise, this will return the fraction of pixels of this element that are contained inside the rectangle.
fractionVisibleInWindowWithInsets
fun fractionVisibleInWindowWithInsets(
topLeftInset: IntOffset,
bottomRightInset: IntOffset
): Float
Used to determine the fraction of pixels that are inside the rectangle defined by the window with the provided insets subtracted.
If the rectangle is entirely contained inside of the bounds, this method will return 1f. Otherwise, this will return the fraction of pixels of this element that are contained inside the rectangle.
Public properties
boundsInRoot
val boundsInRoot: IntRect
The positioned bounding Rect in the coordinates of the root node of the compose hierarchy.
boundsInScreen
val boundsInScreen: IntRect
The positioned bounding Rect in the coordinates of the Screen which it is contained in.
boundsInWindow
val boundsInWindow: IntRect
The positioned bounding Rect in the coordinates of the Window which it is contained in.
positionInRoot
val positionInRoot: IntOffset
The top left position of the Rect in the coordinates of the root node of the compose hierarchy.
positionInScreen
val positionInScreen: IntOffset
The top left position of the Rect in the coordinates of the Screen it is contained in.
positionInWindow
val positionInWindow: IntOffset
The top left position of the Rect in the coordinates of the Window it is contained in