From b95885694d6fecb8e1ee271867315684e0363a45 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 13 Jul 2022 13:27:18 +0300 Subject: [PATCH] Fix tile size rounding on fractional zoom --- src/jvmMain/kotlin/centre/sciprog/maps/compose/MapViewJvm.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/jvmMain/kotlin/centre/sciprog/maps/compose/MapViewJvm.kt b/src/jvmMain/kotlin/centre/sciprog/maps/compose/MapViewJvm.kt index 5af661e..8da587e 100644 --- a/src/jvmMain/kotlin/centre/sciprog/maps/compose/MapViewJvm.kt +++ b/src/jvmMain/kotlin/centre/sciprog/maps/compose/MapViewJvm.kt @@ -23,6 +23,7 @@ import centre.sciprog.maps.* import mu.KotlinLogging import org.jetbrains.skia.Font import org.jetbrains.skia.Paint +import kotlin.math.ceil import kotlin.math.floor import kotlin.math.pow import kotlin.math.roundToInt @@ -169,8 +170,8 @@ actual fun MapView( } clipRect { val tileSize = IntSize( - (mapTileProvider.tileSize.dp * tileScale.toFloat()).roundToPx(), - (mapTileProvider.tileSize.dp * tileScale.toFloat()).roundToPx() + ceil((mapTileProvider.tileSize.dp * tileScale.toFloat()).toPx()).toInt(), + ceil((mapTileProvider.tileSize.dp * tileScale.toFloat()).toPx()).toInt() ) mapTiles.forEach { (id, image) -> //converting back from tile index to screen offset