fix: 修复旋转屏幕后横屏双页模式不生效的问题
根因:旋转后 onSizeChanged 触发 ChapterProvider.upLayout() 正确设置了 doublePage, 但随后的 ReloadContent 因 isInitFinish=false 被跳过。 initData() 设置 isInitFinish=true 后,因为是同一本书 (isSameBook=true), 不会调用 loadContent(),导致内容未用新布局重新加载。 修复:在 initBook() 完成后,如果是同一本书,发送 UpdateLayout + ReloadContent 效果, 确保内容用旋转后的 ChapterProvider 尺寸重新布局。 Fixes #1461 #1397
This commit is contained in:
@@ -1799,6 +1799,15 @@ class ReadBookViewModel(
|
|||||||
ReadBook.resetData(book)
|
ReadBook.resetData(book)
|
||||||
}
|
}
|
||||||
_uiState.update { it.copy(isInitFinish = true) }
|
_uiState.update { it.copy(isInitFinish = true) }
|
||||||
|
// 旋转后 ChapterProvider 的 doublePage/visibleWidth 已在 onSizeChanged 中更新,
|
||||||
|
// 但 ReloadContent 因 isInitFinish=false 被跳过。此处确保内容用新布局重新加载。
|
||||||
|
if (isSameBook) {
|
||||||
|
_effects.tryEmit(
|
||||||
|
ReadBookEffect.UpdateReadViewConfig(
|
||||||
|
setOf(ConfigUpdateAction.UpdateLayout, ConfigUpdateAction.ReloadContent)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
if (!book.isLocal && book.tocUrl.isEmpty() && !loadBookInfo(book)) {
|
if (!book.isLocal && book.tocUrl.isEmpty() && !loadBookInfo(book)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user