What unit of measure use the `Canvas` function `dr...
# compose
b
What unit of measure use the
Canvas
function
drawCircle
? If I draw a circle with a radius of 72 and a
FloatingActionButton
with a size of
72.dp
the circle end up bigger than the button.
Copy code
Box(
    modifier = Modifier.size(120.dp).align(Alignment.TopCenter)
) {
    Canvas(
        modifier = Modifier.align(Alignment.Center)
    ) {
        drawCircle(
            color = MaterialColor.Red400,
            radius = 72f,
        )
    }
    FloatingActionButton(
        modifier = Modifier
            .align(Alignment.Center)
            .size(72.dp),
        backgroundColor = MaterialColor.Orange400,
        onClick = {}
    ) {
        Icon(
            imageVector = Icons.Default.ArrowUpward,
            contentDescription = "!"
        )
    }
}
f
Canvas uses pixels. You can convert between px and dp using
LocalDensity
🙌 1
And I think Canvas scope exposes the conversion functions (density scope) 🤔
🙌 1