Mihai Hrincescu
10/20/2020, 8:45 PM.clickable()
modifier when i scale up a @composable
using .drawLayer()
the hit box not only it does not scale up but it actually scales down and moves down and to the right proportionate to where the the @composable
is placed inside of the available space. Should i just change the size instead or is this just a bug and scaling a @composable
should also scale the hit box?@Composable
fun testScale() {
Box(
modifier = Modifier.fillMaxSize(),
alignment = Alignment.Center
) {
var selected by remember { mutableStateOf(false) }
val scale = if (selected) 2f else 1f
Box(
modifier = Modifier
.size(64.dp)
.drawLayer(scaleX = scale, scaleY = scale)
.background(Color.Green)
.clickable(
onClick = { selected = !selected },
indication = null
)
) {
Text(
modifier = Modifier.align(Alignment.Center),
textAlign = TextAlign.Center,
text = "Button"
)
}
}
}
Zach Klippenstein (he/him) [MOD]
10/20/2020, 9:04 PMMihai Hrincescu
10/20/2020, 9:12 PMZach Klippenstein (he/him) [MOD]
10/20/2020, 9:15 PMdrawLayer
is intended to affect input events as well. I would definitely not expect it to affect input events in the opposite direction.Mihai Hrincescu
10/20/2020, 9:22 PMZach Klippenstein (he/him) [MOD]
10/20/2020, 9:23 PM