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.

Summary

Public functions

List<IntRect>

At the current state of the layout, calculates which other Composable Layouts are occluding the Composable associated with this RelativeLayoutBounds.

Cmn
open operator Boolean
equals(other: Any?)
Cmn
Float

Used to determine the fraction of pixels that are inside the bounds of the viewport.

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(
    topLeftInset: IntOffset,
    bottomRightInset: IntOffset
)

Used to determine the fraction of pixels that are inside the rectangle defined by the window with the provided insets subtracted.

Cmn
open Int
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.

Returns
List<IntRect>

A List of the rectangles that occlude the associated Composable Layout.

equals

open operator fun equals(other: Any?): Boolean

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.

hashCode

open fun hashCode(): Int

Public properties

boundsInRoot

val boundsInRootIntRect

The positioned bounding Rect in the coordinates of the root node of the compose hierarchy.

boundsInScreen

val boundsInScreenIntRect

The positioned bounding Rect in the coordinates of the Screen which it is contained in.

boundsInWindow

val boundsInWindowIntRect

The positioned bounding Rect in the coordinates of the Window which it is contained in.

height

val heightInt

The height, in pixels, of the Rect

positionInRoot

val positionInRootIntOffset

The top left position of the Rect in the coordinates of the root node of the compose hierarchy.

positionInScreen

val positionInScreenIntOffset

The top left position of the Rect in the coordinates of the Screen it is contained in.

positionInWindow

val positionInWindowIntOffset

The top left position of the Rect in the coordinates of the Window it is contained in

width

val widthInt

The width, in pixels, of the Rect