Skip to content

fix(ui): preserve Output preview zoom on parameter reload (#21) - #123

Merged
vigri merged 1 commit into
ScanTailor-Advanced:masterfrom
pablogventura:fix/output-reload-preserve-zoom-21
Apr 16, 2026
Merged

fix(ui): preserve Output preview zoom on parameter reload (#21)#123
vigri merged 1 commit into
ScanTailor-Advanced:masterfrom
pablogventura:fix/output-reload-preserve-zoom-21

Conversation

@pablogventura

Copy link
Copy Markdown

Summary

Fixes the Output-stage behaviour described in #21: changing processing options triggered a full main-area rebuild, and the preview often jumped back to a whole-page view because zoom/scroll state was taken from the wrong ImageViewBase (depth-first search) and the first resizeEvent recentered the focal point.

What changed

  • When the root image widget is output::TabbedImageView, capture and restore zoom/scroll from the active tab (currentWidget()) instead of the first ImageViewBase in the object tree.
  • Persist normalized horizontal/vertical scrollbar positions together with zoom.
  • Reapply saved zoom and scroll on a queued single-shot timer so it runs after the initial layout/resizeEvent, avoiding an immediate wipe of the focal point.

How to test

  1. Open a project, go to Output, stay on the Output tab.
  2. Zoom in (mouse wheel) so only part of the page is visible.
  3. Change a setting that forces a reload (e.g. binarization / mode), as in Feature request: Persistent zoom  #21.
  4. Confirm zoom and approximate framing stay comparable without having to zoom in again each time.

Optional: repeat with another tab selected (e.g. Dewarping) to confirm the active tab’s view is what gets preserved.

Closes #21 if maintainers agree this fully matches the requested behaviour.

…ilor-Advanced#21)

When the Output filter rebuilds its TabbedImageView, read zoom and
scrollbar position from the active tab instead of the first ImageViewBase
in the widget tree. Reapply zoom and normalized scroll after the first
layout pass so ImageViewBase::resizeEvent does not wipe the view state.
@gorgobacka

Copy link
Copy Markdown

I tested this fix and it seems to work as expected. Thanks for analyzing the problem.

However, I can't say anything about the code changes, because I'm not familiar with C++.

@vigri
vigri merged commit 722a5c0 into ScanTailor-Advanced:master Apr 16, 2026
2 of 4 checks passed
@pablogventura
pablogventura deleted the fix/output-reload-preserve-zoom-21 branch May 24, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Persistent zoom

3 participants