I'm clearly missing something about scaling canvas...
# compose
p
I'm clearly missing something about scaling canvases - I have a circle who's center offset is the same as its radius, so it should touch the side of the canvas, and indeed it does when the scale is 1f.
Copy code
@Composable
private fun QuickView() {
  Box(Modifier.wrapContentSize(), border = Border(2.dp, Color.Black)) {
    Canvas(modifier = Modifier.size(200.dp, 200.dp)) {
      val scale = 1f
      scale(scale) {
        drawCircle(Color.Green, 100f, Offset(100f, 100f))
      }
    }
  }
Putting the scale at 0.5f however reduces the radius as expected, but increases the center offset.
s
You'd have to set the anchor/pivot point of your scaling transformation. It looks like it's set at the center of the canvas. You'd want to set it a (0, 0) to keep the circle at the top left corner.
p
Ah, that's sorted it. Thanks!