Fix tile size rounding on fractional zoom

This commit is contained in:
Alexander Nozik 2022-07-13 13:27:18 +03:00
parent 4fc0f3515f
commit b95885694d
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.ceil
import kotlin.math.floor import kotlin.math.floor
import kotlin.math.pow import kotlin.math.pow
import kotlin.math.roundToInt import kotlin.math.roundToInt
@ -169,8 +170,8 @@ actual fun MapView(
} }
clipRect { clipRect {
val tileSize = IntSize( val tileSize = IntSize(
(mapTileProvider.tileSize.dp * tileScale.toFloat()).roundToPx(), ceil((mapTileProvider.tileSize.dp * tileScale.toFloat()).toPx()).toInt(),
(mapTileProvider.tileSize.dp * tileScale.toFloat()).roundToPx() ceil((mapTileProvider.tileSize.dp * tileScale.toFloat()).toPx()).toInt()
) )
mapTiles.forEach { (id, image) -> mapTiles.forEach { (id, image) ->
//converting back from tile index to screen offset //converting back from tile index to screen offset