Paul Woitaschek
12/22/2020, 4:18 PMIgor Demin
12/22/2020, 4:35 PMIs it possible that these issues come from the desktop port?Yes, it is possible. On the lower level we use different code (Canvas and layer manipulation).
should I run it on androidIt is hard to say if the bug is in the common-compose or the desktop-compose without some example. If it reproduces on android then bug is in the common-compose (probably). Do you draw all tiles first before drawing figures? Or is Modifier.zIndex used?
Adam Powell
12/22/2020, 4:43 PMAdam Powell
12/22/2020, 4:44 PMPaul Woitaschek
12/22/2020, 10:45 PMdiff --git a/src/main/kotlin/chess/app.kt b/src/main/kotlin/chess/app.kt
index b37c318..b020af3 100644
--- a/src/main/kotlin/chess/app.kt
+++ b/src/main/kotlin/chess/app.kt
@@ -19,6 +19,7 @@ import androidx.compose.ui.res.vectorXmlResource
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.dp
+import androidx.compose.ui.zIndex
import kotlin.math.roundToInt
@@ -100,6 +101,7 @@ fun BoxScope.ChessPieceImage(
val value = offset.value
IntOffset(value.x.roundToInt(), value.y.roundToInt())
}
+ .zIndex(if (offset.value == Offset.Zero) 0F else 1F)
)
}
Then the tiles don't move on drag at all.Igor Demin
12/23/2020, 12:04 AMzIndex
changes order only for the children of the same parent, so it will not help.
So you need to draw all tiles before figures.Paul Woitaschek
12/23/2020, 8:06 AMIgor Demin
12/23/2020, 8:46 AMDo you have a clue why everything is so tiny? The buttons feel like 12dpIs it Linux with 200% scale? If so, it will be fixed soon (Compose doesn't scale properly in some distributions of Linux https://github.com/JetBrains/compose-jb/issues/188)
Paul Woitaschek
12/23/2020, 8:48 AMPaul Woitaschek
12/23/2020, 8:50 AM