swift-toolkit
swift-toolkit copied to clipboard
Font size change causes a progression shift.
Bug Report
What happened?
When changing the font size, within a title that has images, the location shifts to the beginning of the current chapter.
https://user-images.githubusercontent.com/6921353/169547049-0f12f790-7298-4c5b-9ec4-2789cf5528c6.mp4
Expected behavior
Chapter location should not change.
How to reproduce?
- Open a title that has images
- Navigate to a progression within a chapter
- Change font to a larger or smaller size
- See page position change
Environment
- Readium version: 2.3.0
Development environment
macOS: 12.3.1 platform: arm64 carthage: 0.38.0 Xcode 13.4 Build version 13F17a
Testing device
- iOS version: 13.0, 14.0.1, 15.0, 15.5
- Model (e.g. iPhone 11 Pro Max): 11, 11 Pro, 11 Pro Max, SE, 13 Pro
- Is it an emulator? Simulator, emulator and physical device
Additional context
- Are you willing to fix the problem and contribute a pull request? Yes
Thank you for reporting this issue.
My guess is that this is caused by the fact we are using the scroll percentage to restore the location, for example:
- Current location is 45%.
- We increase the font size.
- The navigator try to reposition to 45%, but ends up slightly before as the number of screen pages is different, for example 44%.
- We decrease the font size.
- The navigator try to reposition at 44%, so we end up at a different page than the one in step 1.
Here's two solutions I think could help:
- Using a text context in the current locator, to restore to a text snippet instead of scroll location.
- Keeping the current locator "frozen" while changing multiple time the user settings, defreezing it when the user actually moves to a different location.