I did a hack to capture touch/mouse events in a la...
# compose
e
I did a hack to capture touch/mouse events in a larger area than an element was laid out in. it seems to work, but are there potential issues with this I'm not seeing?
🚫 1
Copy code
Modifier
    .layout { measurable, constraints ->
        val placeable = measurable.measure(constraints.offset(2 * r, 2 * r))
        val width = constraints.constrainWidth(placeable.width - 2 * r)
        val height = constraints.constrainHeight(placeable.height - 2 * r)
        layout(width, height) { placeable.placeRelative(-r, -r) }
    }
    .pointerInput(...)
    .layout { measurable, constraints ->
        val placeable = measurable.measure(constraints.offset(-2 * r, -2 * r))
        val width = constraints.constrainWidth(placeable.width + 2 * r)
        val height = constraints.constrainHeight(placeable.height + 2 * r)
        layout(width, height) { placeable.placeRelative(r, r) }
    }