This commit is contained in:
Horis
2024-02-24 19:56:34 +08:00
parent 36e6c0c8a4
commit 5cef6f8e39
2 changed files with 11 additions and 11 deletions
@@ -232,11 +232,11 @@ object ReadBook : CoroutineScope by MainScope() {
nextTextChapter = null nextTextChapter = null
if (curTextChapter == null) { if (curTextChapter == null) {
AppLog.putDebug("moveToNextChapter-章节未加载,开始加载") AppLog.putDebug("moveToNextChapter-章节未加载,开始加载")
if (upContentInPlace) callBack?.upContent(resetPageOffset = false) if (upContentInPlace) callBack?.upContent()
loadContent(durChapterIndex, upContent, resetPageOffset = false) loadContent(durChapterIndex, upContent, resetPageOffset = false)
} else if (upContent && upContentInPlace) { } else if (upContent && upContentInPlace) {
AppLog.putDebug("moveToNextChapter-章节已加载,刷新视图") AppLog.putDebug("moveToNextChapter-章节已加载,刷新视图")
callBack?.upContent(resetPageOffset = false) callBack?.upContent()
} }
loadContent(durChapterIndex.plus(1), upContent, false) loadContent(durChapterIndex.plus(1), upContent, false)
saveRead() saveRead()
@@ -263,10 +263,10 @@ object ReadBook : CoroutineScope by MainScope() {
curTextChapter = prevTextChapter curTextChapter = prevTextChapter
prevTextChapter = null prevTextChapter = null
if (curTextChapter == null) { if (curTextChapter == null) {
if (upContentInPlace) callBack?.upContent(resetPageOffset = false) if (upContentInPlace) callBack?.upContent()
loadContent(durChapterIndex, upContent, resetPageOffset = false) loadContent(durChapterIndex, upContent, resetPageOffset = false)
} else if (upContent && upContentInPlace) { } else if (upContent && upContentInPlace) {
callBack?.upContent(resetPageOffset = false) callBack?.upContent()
} }
loadContent(durChapterIndex.minus(1), upContent, false) loadContent(durChapterIndex.minus(1), upContent, false)
saveRead() saveRead()
@@ -336,6 +336,10 @@ class TextChapterLayout(
} }
if (durY + height > visibleHeight) { if (durY + height > visibleHeight) {
val textPage = pendingTextPage val textPage = pendingTextPage
// 双页的 durY 不正确,可能会小于实际高度
if (textPage.height < durY) {
textPage.height = durY
}
if (doublePage && absStartX < viewWidth / 2) { if (doublePage && absStartX < viewWidth / 2) {
//当前页面左列结束 //当前页面左列结束
textPage.leftLineSize = textPage.lineSize textPage.leftLineSize = textPage.lineSize
@@ -352,10 +356,6 @@ class TextChapterLayout(
onPageCompleted() onPageCompleted()
pendingTextPage = TextPage() pendingTextPage = TextPage()
} }
// 双页的 durY 不正确,可能会小于实际高度
if (textPage.height < durY) {
textPage.height = durY
}
durY = 0f durY = 0f
} }
} }
@@ -434,6 +434,9 @@ class TextChapterLayout(
val textLine = TextLine(isTitle = isTitle) val textLine = TextLine(isTitle = isTitle)
if (durY + textHeight > visibleHeight) { if (durY + textHeight > visibleHeight) {
val textPage = pendingTextPage val textPage = pendingTextPage
if (textPage.height < durY) {
textPage.height = durY
}
if (doublePage && absStartX < viewWidth / 2) { if (doublePage && absStartX < viewWidth / 2) {
//当前页面左列结束 //当前页面左列结束
textPage.leftLineSize = textPage.lineSize textPage.leftLineSize = textPage.lineSize
@@ -452,9 +455,6 @@ class TextChapterLayout(
stringBuilder.clear() stringBuilder.clear()
absStartX = paddingLeft absStartX = paddingLeft
} }
if (textPage.height < durY) {
textPage.height = durY
}
durY = 0f durY = 0f
} }
val lineStart = layout.getLineStart(lineIndex) val lineStart = layout.getLineStart(lineIndex)