JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.87k stars 1.15k forks source link

Bug with ImageVector when resize #430

Open LAP2 opened 3 years ago

LAP2 commented 3 years ago

Hi team.

Found that if you create ImageVector from code, put it in Image and try to reize window it will create some sort of trace. here is a code to reproduce:

@Composable
internal actual fun ReproducibleArc(
    modifier: Modifier
) = Box(
    modifier = modifier.fillMaxSize()
) {
    val vi = rememberVectorPainter(
        ImageVector.Builder(
            defaultWidth = 50.dp,
            defaultHeight = 50.dp,
            viewportWidth = 50f,
            viewportHeight = 50f,
        ).apply {
            val center = Offset(25f,25f)
            path(
                stroke = SolidColor(Color.Red),
                fill = SolidColor(Color.Red)
            ) {
                moveTo(center.x, center.y)
                lineToRelative(25f, 0f)
                arcToRelative(25f,25f,0f,false,true,-25f,25f)
                close()
            }
        }.build()
    )
    Surface(
        border = BorderStroke(2.dp, Color.Black),
        modifier = Modifier.wrapContentSize()
    ) {
        Image(
            vi,
            "Circle",
            modifier.fillMaxSize(),
        )
    }
}

StrangeArc Also it seems that arcToRelative theta parameter is not much usable, it could be calculated using other parameters.

akurasov commented 3 years ago

Tried it on Mac&latest build and it works fine. @LAP2 do you still have this issue? If yes, what is the Compose build# and OS?

okushnikov commented 1 month ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.