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

Remove Whitespace for "Export View as PNG" #81

Open
phschaad opened this issue May 6, 2022 · 6 comments
Open

Remove Whitespace for "Export View as PNG" #81

phschaad opened this issue May 6, 2022 · 6 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@phschaad
Copy link
Collaborator

phschaad commented May 6, 2022

Export View as PNG currently includes any whitespace in view. While this is included as transparency, it is desirable to have the resulting export cropped to any actual SDFG Elements (States) that are in view.

@phschaad phschaad added enhancement New feature or request good first issue Good for newcomers labels May 6, 2022
@ojninja16
Copy link
Contributor

hi @phschaad can I pick this up?

@phschaad
Copy link
Collaborator Author

phschaad commented Feb 3, 2025

@ojninja16 Sure! More than welcome to :-)

@ojninja16
Copy link
Contributor

hi @phschaad , can you elaborate on the exact issue here Ig there is no longer an export view as PNG instead we have a save view as PNG ... Thanks

@phschaad
Copy link
Collaborator Author

phschaad commented Feb 4, 2025

That is the button / functionality this issue refers to

@ojninja16
Copy link
Contributor

Hi @phschaad,In the current approach, we are directly using the canvas and then calling toDataURL to generate the images. If I understand correctly, we need to ensure that any unnecessary whitespace is removed from the generated image. To achieve this, we would need to go through each SDFG element on the canvas if any, determine its bounding box values, and use those to calculate the appropriate x, y, width, and height for cropping. Then, we can generate a properly cropped image.?

@phschaad
Copy link
Collaborator Author

Hi @ojninja16 - this sounds exactly right, I don't think there's a convenient alternative solution at the moment. Your understanding of how it's currently being done is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants