https://kotlinlang.org logo
Title
c

Chris Fillmore

02/08/2022, 7:40 PM
Anyone aware of a bug where live-editing literals in Android Studio causes Canvas drawing to draw incorrectly?
I have the following simple canvas (copied verbatim):
Canvas(
    modifier = Modifier
      .clickable {
        onClick()
      },
  ) {
    drawCircle(
      color = Color.White,
      radius = 96f,
      style = Stroke(8f),
    )
    drawRoundRect(
      color = Color.Red,
      topLeft = Offset(-42f, -42f),
      size = Size(84f, 84f),
      cornerRadius = CornerRadius(4f, 4f),
    )
  }
I am doing some live-editing of literals in a seemingly unrelated area of the code, and this is causing the
drawRoundRect
to ignore its
topLeft
Offset
The literal I’m editing is also in an
Offset
, in that case for a
Shadow
Restarting the app seems to fix it.
c

Chris Sinco [G]

02/08/2022, 9:06 PM
I’ve had this general issue with Canvas in Preview but yeah Live Literals causes some funky drawings often. Please file a bug on this if you can with screenshots. Would be very helpful for the team.
c

Chris Fillmore

02/09/2022, 2:48 AM
I have filed https://issuetracker.google.com/issues/218542098 with attached screenshots
c

Chris Sinco [G]

02/09/2022, 6:11 PM
Thank you!