mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-06 10:47:25 +01:00
Fix "Landscape zoom" and "Navigate to pan" for split images (#6647)
* fix: getPageHolder would always return the first split, as they share the same index * split pages have the same number, we need an extra check to know whether we move forward or back
This commit is contained in:
parent
a8ad19a89d
commit
2f07f226b8
@ -161,7 +161,7 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
||||
private fun getPageHolder(page: ReaderPage): PagerPageHolder? =
|
||||
pager.children
|
||||
.filterIsInstance(PagerPageHolder::class.java)
|
||||
.firstOrNull { it.item.index == page.index }
|
||||
.firstOrNull { it.item == page }
|
||||
|
||||
/**
|
||||
* Called when a new page (either a [ReaderPage] or [ChapterTransition]) is marked as active
|
||||
@ -171,8 +171,15 @@ abstract class PagerViewer(val activity: ReaderActivity) : BaseViewer {
|
||||
if (page != null && currentPage != page) {
|
||||
val allowPreload = checkAllowPreload(page as? ReaderPage)
|
||||
val forward = when {
|
||||
currentPage is ReaderPage && page is ReaderPage ->
|
||||
page.number > (currentPage as ReaderPage).number
|
||||
currentPage is ReaderPage && page is ReaderPage -> {
|
||||
// if both pages have the same number, it's a split page with an InsertPage
|
||||
if (page.number == (currentPage as ReaderPage).number) {
|
||||
// the InsertPage is always the second in the reading direction
|
||||
page is InsertPage
|
||||
} else {
|
||||
page.number > (currentPage as ReaderPage).number
|
||||
}
|
||||
}
|
||||
currentPage is ChapterTransition.Prev && page is ReaderPage ->
|
||||
false
|
||||
else -> true
|
||||
|
Loading…
Reference in New Issue
Block a user