https://kotlinlang.org logo
#compose
Title
# compose
a

Ahmed Elhanafy

06/18/2020, 8:02 PM
Hello folks, I was wondering if Jetpack compose has a GeometryReader alternative, or any other way of measuring a node's absolute position
z

Zach Klippenstein (he/him) [MOD]

06/18/2020, 8:11 PM
Modifier.onPositioned
gives you a
LayoutCoordinates
object which can give you global coordinates
a

Ahmed Elhanafy

06/18/2020, 9:01 PM
@Zach Klippenstein (he/him) [MOD] But there isn't an imperative API similar to the dom, right?
z

Zach Klippenstein (he/him) [MOD]

06/18/2020, 9:01 PM
nope
not that i’m aware of, there aren’t really any imperative apis in compose. You can make a
MutableState
and put the coordinates from the
onPositioned
callbacks in your state
👍 1
a

Ahmed Elhanafy

06/18/2020, 9:06 PM
Yeah, sure! Thanks!