onLayoutRectChanged
fun Modifier.onLayoutRectChanged(
throttleMillis: Long = 0,
debounceMillis: Long = 64,
callback: (RelativeLayoutBounds) -> Unit,
) = this then OnLayoutRectChangedElement(throttleMillis, debounceMillis, callback)
Invokes callback 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 throttleMillis will prevent callback from being executed more than once over that
time period. Specifying debounceMillis will delay the execution of callback 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 throttleMillis and debounceMillis 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 throttleMillis but a zero debounceMillis is
equivalent to providing the same value for both throttleMillis and debounceMillis.
Parameters
| throttleMillis | The duration, in milliseconds, to prevent callback from being executed more than once over that time period. |
| debounceMillis | The duration, in milliseconds, to delay the execution of callback until that amount of time has elapsed without a new position. |
| callback | The callback to be executed. |
