# onLayoutRectChanged

Common/AllAndroid/JVM

## Functions summary

|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` | `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier.https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/onLayoutRectChanged.modifier#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)( throttleMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, debounceMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, callback: (https://developer.android.com/reference/kotlin/androidx/compose/ui/spatial/RelativeLayoutBounds) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Invokes `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` with the position of this layout node relative to the coordinate system of the root of the composition, as well as in screen coordinates and window coordinates. | Cmn |

## Functions

### Modifier.onLayoutRectChanged

Cmn Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/layout/OnLayoutRectChangedModifier.kt+function:onLayoutRectChanged) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun Modifier.onLayoutRectChanged(
    throttleMillis: Long = 0,
    debounceMillis: Long = 64,
    callback: (RelativeLayoutBounds) -> Unit
): Modifier
```

Invokes `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` with the position of this layout node relative to the coordinate system of the root of the composition, as well as in screen coordinates and window coordinates. This will be called after layout pass. This API allows for throttling and debouncing parameters in order to moderate the frequency with which the callback gets invoked during high rates of change (e.g. scrolling).

Specifying `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` will prevent `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` from being executed more than once over that time period. Specifying `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` will delay the execution of `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` until that amount of time has elapsed without a new position, scheduling the callback to be executed when that amount of time expires.

Specifying 0 for both `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` will result in the callback being executed every time the position has changed. Specifying non-zero amounts for both will result in both conditions being met. Specifying a non-zero `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` but a zero `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` is equivalent to providing the same value for both `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` and `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)`.

| Parameters |
|---|---|
| `throttleMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 0` | The duration, in milliseconds, to prevent `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` from being executed more than once over that time period. |
| `debounceMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html = 64` | The duration, in milliseconds, to delay the execution of `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.Modifier).onLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` until that amount of time has elapsed without a new position. |
| `callback: (https://developer.android.com/reference/kotlin/androidx/compose/ui/spatial/RelativeLayoutBounds) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The callback to be executed. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/spatial/RelativeLayoutBounds` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/onGloballyPositioned.modifier#(androidx.compose.ui.Modifier).onGloballyPositioned(kotlin.Function1)` |   |
| `https://developer.android.com/reference/kotlin/androidx/compose/ui/layout/package-summary#(androidx.compose.ui.node.DelegatableNode).registerOnLayoutRectChanged(kotlin.Long,kotlin.Long,kotlin.Function1)` |   |