fun DelegatableNode.registerOnLayoutRectChanged(
throttleMillis: Long,
debounceMillis: Long,
callback: (RelativeLayoutBounds) -> Unit,
): RegistrationHandle
Registers a callback to be executed with the position of this modifier 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.
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.
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. |
Returns
| an object which should be used to unregister/dispose this callback |