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

Add glOptions to GraphCanvas to extend gl configutation #132

Merged
merged 2 commits into from
Sep 18, 2023

Conversation

footnoise
Copy link
Contributor

After some internet search, found that to make ability to save/download Canvas as a picture extra configuration should be passed to gl attribute as preserveDrawingBuffer: true. To avoid hardcoded value, decided to make it as configurable parameter on user level.

// If canvas is created like this:
<GraphCanvas glOptions={{ preserveDrawingBuffer: true }}/>


// the following pseudo-code should work
const url = getControls()._domElement?.toDataURL();
const fakeDownloader = document.createElement('a');
fakeDownloader.href = url;
fakeDownloader.download = 'canvas';
fakeDownloader.click();
fakeDownloader.remove();

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[ ] No

Other information

Copy link
Member

@amcdnl amcdnl left a comment

Choose a reason for hiding this comment

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

Awesome!

@amcdnl amcdnl merged commit 5b9e2d8 into reaviz:master Sep 18, 2023
1 check passed
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.

2 participants