-
Notifications
You must be signed in to change notification settings - Fork 831
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
Implement toBlob function on ModelViewerElementBase #861
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maaslalani
commented
Oct 31, 2019
cdata
suggested changes
Oct 31, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks for the contribution @maaslalani !
Mostly minor feedback.
…Chrome Desktop and Firefox
…ther utility functions.
…lency between supported and unsupported browsers
maaslalani
commented
Nov 1, 2019
Push build running now: https://travis-ci.org/GoogleWebComponents/model-viewer/jobs/606219986 |
cdata
reviewed
Nov 1, 2019
cdata
reviewed
Nov 1, 2019
cdata
suggested changes
Nov 4, 2019
Thanks for the great work on this @maaslalani LGTM 💯 |
cdata
approved these changes
Nov 5, 2019
elalish
pushed a commit
to elalish/model-viewer
that referenced
this pull request
Feb 4, 2020
* Implement toBlob function on model-viewer-base * Update documentation to specify qualityArgument is only available on Chrome Desktop and Firefox * Prefer Url over URL casing * Add License, Descriptive comment, and adjusted style guide to match other utility functions. * Utility function dataUrlToBlob async * Use spy helper to emulate unsupported browser and add test for equivalency between supported and unsupported browsers * Add support for msToBlob for IE * Remove .only from test suite * Compare arrayBuffers * Try and catch errors because spy toBlob will throw on edge * Skip test on IE11 and add comment on using Response * Remove https?: from objectUrlMatcher
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reference Issue
Fixes #858
Adds
toBlob
to theModelViewerElementBase
.https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob
General Approach
The general approach was to delegate the
toBlob
on the model-viewer to the canvas. Instead of using callbacks likeHTMLCanvasElement
does withtoBlob
, I used promises so that it is possible to useasync/await
syntax. We can change this back if needed.