-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
reflect NUM_FRACTION_DIGITS to SVG path data #8782
Conversation
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.
Thanks
Good job
Add a changelog please
And run Read the CONTRIBUTING.md for more details on how to finish up the PR |
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.
Passing undefined to toFixed
rounds the number entirely so that doesn't support what was before.
So I guess we should make the arg non optional as you did but I am not sure.
It is used only by the _toSVG
method so I think it doesn't really matter.
@asturur thoughts?
This is fine. |
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.
Please add BREAKING in front of the changelog line
Sure thing, done. |
@ShaMan123 your question was collapsed for me and i didn't see. so for joinPath toFixed was good as an optional parameter, and if is isn't passed should not truncte the numbers |
Added an extra test
Hi, I am using the custom build version which is 5.2. Is this update available there ? |
No. |
Is version 6 production ready ? |
beta |
Motivation
Fix #5734.
toSVG
does not considerNUM_FRACTION_DIGITS
in exporting path data, which makes the resulting SVG (and JSON eventually) unnecessarily large.Description
util.path.joinPath()
seriarizes SVG path data by joining commands. This change is to extend the function by additing thefractionDigits
argument, which represents the number of fraction digits for the serialized SVG path data.Changes
joinPath
function. If no argument is passedtoFixed
will round it to an intjoinPath
function withconfig.NUM_FRACTION_DIGITS
.joinPath
function.In Action
Before:
![Screenshot 2023-03-14 21 49 37](https://user-images.githubusercontent.com/734905/225006102-751b2620-a563-4f8a-a697-3f7d71888b0a.png)
After:
![Screenshot 2023-03-14 21 47 18](https://user-images.githubusercontent.com/734905/225006137-f5d8a243-3ce5-4e17-9f90-0eb80ef221fc.png)