From bc8052fde9314d37c55b343024ad61bc52b9e95c Mon Sep 17 00:00:00 2001 From: Horis <8674809+821938089@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:35:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/page/provider/TextChapterLayout.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt index a45aed841..211c54269 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/TextChapterLayout.kt @@ -33,6 +33,7 @@ import kotlinx.coroutines.launch import java.util.LinkedList import java.util.Locale import kotlin.coroutines.coroutineContext +import kotlin.math.max import kotlin.math.roundToInt class TextChapterLayout( @@ -446,7 +447,7 @@ class TextChapterLayout( val textLine = TextLine(isTitle = isTitle) if (durY + textHeight > visibleHeight) { val textPage = pendingTextPage - val height = textPage.lines.lastOrNull()?.lineBottom ?: 0f + val height = max(durY, textPage.lines.lastOrNull()?.lineBottom ?: 0f) if (textPage.height < height) { textPage.height = height } @@ -531,7 +532,7 @@ class TextChapterLayout( val textPage = pendingTextPage textPage.addLine(textLine) durY += textHeight * lineSpacingExtra - val height = textPage.lines.lastOrNull()?.lineBottom ?: 0f + val height = max(durY, textPage.lines.lastOrNull()?.lineBottom ?: 0f) if (textPage.height < height) { textPage.height = height }