Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: preservation of viewport doesnt work #3922

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fstoe
Copy link

@fstoe fstoe commented Jun 26, 2024

I recently found out that setting preserveViewport in the osd settings does nothing.
So I made some little changes to the OpenSeadragonViewer Component and to the setcanvas action.

@fstoe fstoe changed the title fix: preservation of viewport doesnt work Bug fix: preservation of viewport doesnt work Jun 26, 2024
if (canvasesChanged && viewer.preserveViewport) {
this.addAllImageSources(false);
} else {
this.addAllImageSources((canvasesChanged || !viewerConfig));
Copy link
Member

@marlo-longley marlo-longley Jul 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found this negative logic a bit hard to follow (not from what you wrote, but from what existed before!) -- what do you think about adding comments similar to:

 if (canvasesChanged && viewer.preserveViewport) {
        // Do not reset the zoom
        this.addAllImageSources(false);
      } else {
       // Reset the zoom if the canvas has changed or if there is no viewerConfig
        this.addAllImageSources((canvasesChanged || !viewerConfig));
      }
...

?

Personally the name zoomAfterAdd parameter did not help me understand what was going on. Maybe resetZoomAfterAdd would have been better, or maybe it's just me!

@marlo-longley
Copy link
Member

@fstoe I tested this locally and it works well, thank you for submitting.

marlo-longley
marlo-longley previously approved these changes Jul 3, 2024
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.

None yet

2 participants