Fix some inspection issues

This commit is contained in:
Christian Basler
2025-07-17 22:45:52 +02:00
parent 1800174087
commit 1836f53d7b
15 changed files with 36 additions and 37 deletions

View File

@@ -4,7 +4,7 @@ import ch.dissem.yaep.domain.Game
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.CoroutineScope
val log = KotlinLogging.logger {}
private val log = KotlinLogging.logger {}
actual fun CoroutineScope.logGame(game: Game) {
log.debug { "Game: $game" }

View File

@@ -180,17 +180,17 @@ fun PuzzleGrid(
item.options.add(it)
},
selectedItem = selection,
onSelectItem = {
if (it != null) {
onSelectItem = { selectedItem ->
if (selectedItem != null) {
grid.snapshot()
item.selection = it
item.selection = selectedItem
row.cleanupOptions()
} else {
while (item.selection != null) {
if (!grid.undo()) break
}
options.forEach {
it.enabled = item.options.contains(it.item)
options.forEach { option ->
option.enabled = item.options.contains(option.item)
}
}
}

View File

@@ -22,14 +22,14 @@ private enum class AspectRatio {
PORTRAIT, LANDSCAPE, SQUARISH;
companion object {
private const val landscapeRatio = 1.4f
private const val portraitRatio = 1 / landscapeRatio
private const val ASPECT_RATIO_LANDSCAPE = 1.4f
private const val ASPECT_RATIO_PORTRAIT = 1 / ASPECT_RATIO_LANDSCAPE
fun from(constraints: Constraints): AspectRatio {
val ratio = constraints.maxWidth.toFloat() / constraints.maxHeight.toFloat()
return when {
ratio < portraitRatio -> PORTRAIT
ratio > landscapeRatio -> LANDSCAPE
ratio < ASPECT_RATIO_PORTRAIT -> PORTRAIT
ratio > ASPECT_RATIO_LANDSCAPE -> LANDSCAPE
else -> SQUARISH
}
}

View File

@@ -12,7 +12,7 @@ import kotlin.io.path.writeText
import kotlin.time.Clock
import kotlin.time.ExperimentalTime
val log = KotlinLogging.logger {}
private val log = KotlinLogging.logger {}
@OptIn(ExperimentalTime::class)
actual fun CoroutineScope.logGame(game: Game) {