Fix some inspection issues
This commit is contained in:
@@ -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" }
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user