swift-toolkit icon indicating copy to clipboard operation
swift-toolkit copied to clipboard

Font size change causes a progression shift.

Open mauricecarrier7 opened this issue 3 years ago • 1 comments

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?

  1. Open a title that has images
  2. Navigate to a progression within a chapter
  3. Change font to a larger or smaller size
  4. 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

mauricecarrier7 avatar May 20 '22 17:05 mauricecarrier7

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:

  1. Current location is 45%.
  2. We increase the font size.
  3. The navigator try to reposition to 45%, but ends up slightly before as the number of screen pages is different, for example 44%.
  4. We decrease the font size.
  5. 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.

mickael-menu avatar May 25 '22 16:05 mickael-menu