Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
821938089 committed Dec 23, 2024
1 parent 5bc9cc4 commit 4320bd1
Showing 1 changed file with 11 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -342,34 +342,23 @@ class TextChapterLayout(
}

Book.imgStyleSingle -> {
width = ChapterProvider.visibleWidth
height = size.height * ChapterProvider.visibleWidth / size.width
if (height > ChapterProvider.visibleHeight) {
width = width * ChapterProvider.visibleHeight / height
height = ChapterProvider.visibleHeight
width = visibleWidth
height = size.height * visibleWidth / size.width
if (height > visibleHeight) {
width = width * visibleHeight / height
height = visibleHeight
}
if (durY > 0f) {
val textPage = pendingTextPage
// 双页的 durY 不正确,可能会小于实际高度
if (textPage.height < durY) {
textPage.height = durY
}
if (doublePage && absStartX < viewWidth / 2) {
//当前页面左列结束
textPage.leftLineSize = textPage.lineSize
absStartX = viewWidth / 2 + paddingLeft
} else {
//当前页面结束
if (textPage.leftLineSize == 0) {
textPage.leftLineSize = textPage.lineSize
}
textPage.text = stringBuilder.toString().ifEmpty { "本页无文字内容" }
stringBuilder.clear()
textPages.add(textPage)
coroutineContext.ensureActive()
onPageCompleted()
pendingTextPage = TextPage()
}
textPage.text = stringBuilder.toString().ifEmpty { "本页无文字内容" }
stringBuilder.clear()
textPages.add(textPage)
coroutineContext.ensureActive()
onPageCompleted()
pendingTextPage = TextPage()
durY = 0f
}
}
Expand Down

0 comments on commit 4320bd1

Please sign in to comment.