diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt index e195684f8..2aa3bb905 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt @@ -123,11 +123,18 @@ object ChapterProvider { var durY = y ImageProvider.getImage(book, src)?.let { var height = it.height - val width = if (it.width > visibleWidth) { + var width = it.width + if (it.width > visibleWidth) { height = it.height * visibleWidth / it.width - visibleWidth - } else { - it.width + width = visibleWidth + } + if (height > visibleHeight) { + width = width * visibleHeight / height + height = visibleHeight + } + if (durY + height > visibleHeight) { + textPages.add(TextPage()) + durY = 0f } val textLine = TextLine(isImage = true) textLine.lineTop = durY