Fix rounding of zoom
This commit is contained in:
parent
b764fdd95a
commit
4fc0f3515f
@ -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) }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user