From 8cc16e10b6c7ca653d1d814b31a92a40b62e45e8 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 12 Jul 2020 08:55:59 +0800 Subject: [PATCH] =?UTF-8?q?epub=20=E6=98=BE=E7=A4=BA=E5=9B=BE=E7=89=87,?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/page/ChapterProvider.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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