theapache64
01/19/2022, 10:57 AMComposable
in the viewport, I am using a custom modifier with onGloballyPositioned
method. Inside the lambda, am comparing the x and y
cords of the Composable
and compare it with window height/width. It works, but am wondering if there’s any better method/approach? 🙂cb
01/19/2022, 11:29 AMonGloballyPositioned
should generally be avoided (as much as possible) as it will be called a lot. It's kinda similar to ViewTreeObserver.OnGlobalLayoutListener
which is invoked when any layout has happened.
Feels like this would be better implemented as a onPositionChanged
modifier, analogous to Modifier.onSizeChanged
. That doesn't exist though.theapache64
01/19/2022, 11:31 AMcb
01/19/2022, 11:32 AMtheapache64
01/19/2022, 11:32 AMcb
01/19/2022, 11:42 AMtheapache64
01/19/2022, 12:10 PM