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

Saved Image is Blank When Scaling Factor > 5 #119

Open
dhollis6 opened this issue Nov 16, 2023 · 2 comments
Open

Saved Image is Blank When Scaling Factor > 5 #119

dhollis6 opened this issue Nov 16, 2023 · 2 comments

Comments

@dhollis6
Copy link

How to replicate:

  1. Visit https://sulcgroup.github.io/oxdna-viewer/ on the latest version of Chrome.
  2. Go to the Edit tab and create a 10 bp duplex. Zoom in so the duplex fills the screen.
  3. Go to File and under Image Size, increase Scaling Factor to 5. Click camera icon to download image.
  4. Set Scaling Factor to 6 and download image again.
  5. The first image will show the structure, while the second image will appear fully transparent.

Issue persists in orthographic mode. I'm running Windows 11 on a laptop with a 4k screen, if that matters. Also observed this issue in Edge and DuckDuckGo but did not thoroughly investigate. Odd because I remember downloading super hi-res images not too long ago. Also, I remember having an issue before where the image would appear cropped i.e. taken in a wrong area of the scene. This might be a clue.

@ErikPoppleton
Copy link
Collaborator

ErikPoppleton commented Nov 16, 2023

Reproduction attempts:

MacOS

  • Safari - No, able to save 10x scaling with no problem (18 MB file tho)
  • Firefox - Throws error saying "Canvas is too large to save"
  • Chrome - Reproduced.

Looks like Chrome has the same canvas size limit as Firefox but we're not catching the error correctly (there's nothing in the console either). Will investigate further.

This is the responsible bit of code (from UI.ts):

        new Promise((resolve) => {
            this.scaleCanvas(scaleFactor);
            resolve('success');
        }).then(() => {
            try {
                saveImage();
            } catch (error) {
                notify("Canvas is too large to save, please try a smaller scaling factor", "alert");
            }
            this.scaleCanvas(1/scaleFactor);
        });

So Chrome(ium) isn't throwing an error at all. Will probably have to hardcode whatever the limit is.

@dhollis6
Copy link
Author

dhollis6 commented Nov 30, 2023

Thank you for investigating, Erik! Apologies for the delayed reply.

Edit: It's not clear to me if you wanted to leave this issue open and eventually hardcode the limit, or close this issue and have users hardcode it on an individual basis. I'll leave it to you.

Daniel

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

2 participants