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

Viewer element resize after screenshot #2

Open
vz-chameleon opened this issue Jul 12, 2017 · 4 comments
Open

Viewer element resize after screenshot #2

vz-chameleon opened this issue Jul 12, 2017 · 4 comments
Assignees

Comments

@vz-chameleon
Copy link

vz-chameleon commented Jul 12, 2017

Hi !
I'm trying to use your plugin to take screenshots of my OpenSeaDragon viewer and i came across an interesting bug : I had the developper console for Firefox open and after I've taken a simple screenshot (with the 'Just take a screenshot' option) the viewport size is reduced. Same happens if i resize the browser's page, take a screenshot, and then go back to a full page size. I've attached some screenshots to illustrate.

Looking through your plugin I saw that at some point you redefine the viewer's element height and width
viewer.element.style.height = output_y_size + "px";
viewer.element.style.width = output_y_size + "px";

Is this necessary to take the screenshot ? I've commented all redefinitions of viewer element's height and width and this seems to fix the bug, but I don't know if by doing so i've killed off some functionalities

Thanks in advance for your help ! :)

viewport_resize_issue1_before
viewport_resize_issue1_after
viewport_resize_issue2_before
viewport_resize_issue2_after

@KTGLeiden
Copy link
Owner

KTGLeiden commented Jul 12, 2017

Hi there!

I will look into this tomorrow. Thanks for the pointer, it's some time ago but I think I'll find out :)

Thanks,

~Koen

  • Edit:
    Height should not be altered when just taking a screenshot. This is definitely a bug. The reason why I do this is the option for bigger resolutions (the idea is just to make the canvas size bigger, wait for a reload and snap it). This was especially useful in applications regarding extremely high resolution tissue scans (which I worked with).
    Whatever is going wrong, no idea, but I do recall not testing (a lot) on FF, will do so tommorow.

Cheers,
~Koen

@KTGLeiden
Copy link
Owner

@vz-chameleon :
It actually "works correctly", but only when the viewer is set to a certain size. You probably defined yours as an percentage of the screen, which allows you to scale your display.

What happens is that I first:

  • Save current size in pixels
  • Alter size
  • Take snapshot
  • Reset size to the original one

So this obviously does not work when you want your display to scale.
Let me think about a fix. I have no idea where this percentage style is saved, actually.

In the mean time, it might be satisfyable for you to comment out the lines you mentioned and disable the "showOptions" variable. This means you're always "just" making a screenshot, but it does not touch the dimensions of your viewer.

~Koen

@vz-chameleon
Copy link
Author

You're right, I defined mine with a percentage of the screen.
Thank you very much for your help ! I'll try to find a fix also, after I'm done with some other features
Cheers 👍

@andydu001
Copy link

Hi,
I would like to use your openseadragon-screenshot, but it has some bugs in it. Can you help me out please?
Andy

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

No branches or pull requests

3 participants