Thread
#compose
    m

    Mihai Hrincescu

    1 year ago
    Hello everyone I've encountered some weird behaviour with
    .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]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    sounds like a bug to me. i’d file it
    m

    Mihai Hrincescu

    1 year ago
    I was thinking that maybe i miss use the api because i scale using the draw layer and do not touch the layout. Thanks @Zach Klippenstein (he/him) [MOD] i will file it.
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    From previous discussions, i believe
    drawLayer
    is intended to affect input events as well. I would definitely not expect it to affect input events in the opposite direction.
    m

    Mihai Hrincescu

    1 year ago
    So the API should work as i thought it would. That means that it's definitely a bug.
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    I think it should. File it anyway - if it's not a bug, it's a signal that the docs aren't clear