Fix rounding of zoom

This commit is contained in:
Alexander Nozik 2022-07-13 12:59:57 +03:00
parent b764fdd95a
commit 4fc0f3515f
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357

View File

@ -23,6 +23,7 @@ import centre.sciprog.maps.*
import mu.KotlinLogging import mu.KotlinLogging
import org.jetbrains.skia.Font import org.jetbrains.skia.Font
import org.jetbrains.skia.Paint import org.jetbrains.skia.Paint
import kotlin.math.floor
import kotlin.math.pow import kotlin.math.pow
import kotlin.math.roundToInt import kotlin.math.roundToInt
@ -49,7 +50,7 @@ actual fun MapView(
var viewPoint by remember { mutableStateOf(initialViewPoint) } var viewPoint by remember { mutableStateOf(initialViewPoint) }
val zoom: Int by derivedStateOf { viewPoint.zoom.roundToInt() } val zoom: Int by derivedStateOf { floor(viewPoint.zoom).toInt() }
val tileScale: Double by derivedStateOf { 2.0.pow(viewPoint.zoom - zoom) } val tileScale: Double by derivedStateOf { 2.0.pow(viewPoint.zoom - zoom) }