-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: add format and quality parameters toDataURL function #2431
base: main
Are you sure you want to change the base?
feat: add format and quality parameters toDataURL function #2431
Conversation
… format type: png/jpeg also we can pass quality value to jpeg format
…ction validateJpegQualityParameter
…arameter function
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.
A few more, rest looks good to me.
…nto feat/toDataURL-add-format-and-quality-parameters
…side, and add tsdoc
src/elements/Svg.tsx
Outdated
* @deprecated use size property instead | ||
* @param callback | ||
* @param options as { size: { width: number, height: number }, format: 'jpeg' | 'png', quality?:1 } |
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.
https://jsdoc.app/tags-callback
callback should be typed
https://jsdoc.app/tags-type
quality is not an explicit 1
value but rather a number in range {0, 1}
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.
updated JSdoc, let me know if it's good enough for us.
…nto feat/toDataURL-add-format-and-quality-parameters
Co-authored-by: Jakub Grzywacz <[email protected]>
Co-authored-by: Jakub Grzywacz <[email protected]>
Co-authored-by: Jakub Grzywacz <[email protected]>
…nto feat/toDataURL-add-format-and-quality-parameters
Summary
Feature #1588
Introduce new parameters, format, and quality, for the toDataURL function.
Allow users to select the compressed format (defaulting to PNG or JPEG) in the toDataURL function. Additionally, include a new parameter called quality for the JPEG format.
Created a new type, ToDataUrlOptions, and exported it externally.
The data structure appears as follows:
Test Plan
What's required for testing (prerequisites)?
What are the steps to reproduce (after prerequisites)?
Compatibility
Checklist
README.md