Fix: thumbnail navigation bug when zoomed in (#1401) #1406
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix for Thumbnail Mode Navigation Bug
This PR fixes the issue where page flipping in thumbnail mode becomes stuck, with visual display showing the new page but page index incorrectly reverting to the previous page. A typo in
ModeThumb.jsis also fixed.Problem Analysis:
✅ The root cause of this issue has been identified:
jumpToIndexmethod callsthis.br.drawLeafs()(invoked when animating) instead ofthis.drawLeafs(index), no parameter is passed. ThusscrollTopis not reset byseekTopscrollTopis underestimated, thusleastVisibleandmostVisibleare not calculated as desiredleastVisibletomostVisible)firstIndexto the last visible pageFix Implementation:
✅ Two key changes were made to resolve this issue:
Prevent index modification during animation:
firstIndexwhen animation is in progressEnsure proper redraw after animation completes:
this.br.drawLeafs()tothis.drawLeafs(index)this.drawLeafs(index)after animation completes🛠 Testing Done:
✅ Expected Outcome:
Observation
this.br.refs.$brContainer.prop('scrollTop') == leafTopnever returns true. There is always a difference between them. I didn't figure out the reason.I hope this helps!