fix(ereader): restore cover position when navigating back to the cover
previous_page() set the on-cover flag but left current_position at the first content block, so "showing the cover" had two different internal representations depending on how you got there: block 0 on a fresh load, block 1 after going forward and back. current_position is what gets persisted, so closing the book while on the cover reopened it past the cover, silently losing it. Reset current_position to block 0 when returning to the cover, matching where a fresh load sits. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -453,6 +453,12 @@ class EreaderLayoutManager:
|
|||||||
# Special case: if at the beginning of content and there's a cover, go back to it
|
# Special case: if at the beginning of content and there's a cover, go back to it
|
||||||
if self._has_cover and self._is_at_beginning() and not self._on_cover_page:
|
if self._has_cover and self._is_at_beginning() and not self._on_cover_page:
|
||||||
self._on_cover_page = True
|
self._on_cover_page = True
|
||||||
|
# Restore the canonical cover position. Being on the cover must have a
|
||||||
|
# single representation: a fresh load sits at block 0 with the cover
|
||||||
|
# showing, so returning to the cover has to land there too. Leaving the
|
||||||
|
# position at the first content block saves a position that reopens past
|
||||||
|
# the cover, silently losing it.
|
||||||
|
self.current_position = RenderingPosition()
|
||||||
self._notify_position_changed()
|
self._notify_position_changed()
|
||||||
return self.get_current_page()
|
return self.get_current_page()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user