From 84acae27b71fe7549a992d214631292929d4c6aa Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Mon, 8 May 2023 20:00:05 +0700 Subject: [PATCH] ChapterNavigator: Fix rounding error when changing page with slider (#9477) ChapterNavigator: Fix rounding error when changing page from slider --- .../java/eu/kanade/presentation/reader/ChapterNavigator.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/presentation/reader/ChapterNavigator.kt b/app/src/main/java/eu/kanade/presentation/reader/ChapterNavigator.kt index a4321fa2cd..c7806af434 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ChapterNavigator.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ChapterNavigator.kt @@ -35,6 +35,7 @@ import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import eu.kanade.presentation.util.isTabletUi import eu.kanade.tachiyomi.R +import kotlin.math.roundToInt @Composable fun ChapterNavigator( @@ -106,7 +107,7 @@ fun ChapterNavigator( valueRange = 1f..totalPages.toFloat(), steps = totalPages - 2, onValueChange = { - onSliderValueChange(it.toInt() - 1) + onSliderValueChange(it.roundToInt() - 1) }, interactionSource = interactionSource, )