Pau Marzo
05/27/2024, 1:39 PMfun Modifier.debugBorder(color: Color) = this.drawWithCache {
val border = 2.dp.toPx()
onDrawWithContent {
drawContent()
drawRoundRect(
topLeft = Offset(-border / 2, -border / 2),
size = Size(
width = size.width + border,
height = size.height + border
),
color = Color.Magenta.copy(alpha = 1f),
style = Stroke(width = border)
)
}
}
if i put this modifier in a text composable inside a M3 button, the drawing will showed clipped due to the shape clipping of the button (which i dont want to touch in any way). Is there any way in which i can draw the rect without having any parent composable clip it? Putting the drawing on top of the parent composable (in a canvas) and then draw from there is not an option because i would have to provide the position of the text in the window and then apply the offset to the canvas, but when theres multiple composables (eg 100) becomes unmaintainable. Thanks!Zach Klippenstein (he/him) [MOD]
05/27/2024, 5:07 PMPau Marzo
05/27/2024, 5:54 PMZach Klippenstein (he/him) [MOD]
05/27/2024, 6:11 PMZach Klippenstein (he/him) [MOD]
05/27/2024, 6:12 PMPau Marzo
05/27/2024, 6:29 PMZach Klippenstein (he/him) [MOD]
05/27/2024, 6:33 PM