https://kotlinlang.org logo
Title
t

Timo Drick

03/17/2021, 4:04 AM
During porting my entries for the ComposeDevChallenge i noticed a glitch in the Canvas drawArc function. It looks like i have to substract the offset of each axis from the size. Otherwise the arc is distorted.
fun main() = Window {
    Canvas(Modifier.fillMaxSize()) {
        val d = size.minDimension
        val r = d / 2f
        val offset = Offset((size.width / 2f - r), size.height / 2f - r)
        drawArc(
            color = Color.Green,
            size = Size(d - offset.x, d - offset.y),
            topLeft = offset,
            startAngle = -90f,
            sweepAngle = 270f,
            useCenter = true
        )
    }
}
Ok this issue is already fixed in build: 0.4.0-build173
🎉 1