jonc
03/17/2022, 11:26 PMgraphicsLayer modifier to an Image . I need the size of the image respective to content scale in order to implement some customized gestures. I've tried onSizeChanged and onGloballyPositioned but those seem to be used for the layouts rather than graphics so it isn't called when transformations are made through graphicsLayerigor.korotenko
03/17/2022, 11:50 PMBoxWithConstraintsZach Klippenstein (he/him) [MOD]
03/18/2022, 2:35 PMjonc
03/18/2022, 6:55 PMonSizeChanged and onGloballyPositioned are only called initially. When scaling, rotating or offsetting the image it's not calling them.
Image(
modifier = Modifier
.fillMaxSize()
.onSizeChanged {
Log.v("onSizeChanged", it.toString())
}
.onGloballyPositioned {
Log.v("onGloballyPositioned", "Parent: " + it.boundsInParent())
Log.v("onGloballyPositioned", "Window: " + it.boundsInWindow())
Log.v("onGloballyPositioned", "Root: " + it.boundsInRoot())
}
.graphicsLayer {
scaleX = scale
scaleY = scale
rotationZ = rotation
translationX = offsetX
translationY = offsetY
},
painter = rememberImagePainter(photoUrl),
contentDescription = stringResource(id = R.string.close_image)
)jonc
03/18/2022, 10:45 PMZach Klippenstein (he/him) [MOD]
03/19/2022, 9:25 PMonPlaced will get invoked for those changes?jonc
03/19/2022, 10:50 PMZach Klippenstein (he/him) [MOD]
03/22/2022, 11:21 PMjonc
03/24/2022, 1:28 PM