Repository navigation
feat: add clone to copy path data before transforming it - #102
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
Transformers such as toAbs, normalizeST and qtToC rewrite each command in place, so transforming a copy made from the commands array alone also changes the original. clone() copies every command with the CLONE transformer, the copy CALCULATE_BOUNDS already takes for the same reason.
Contributor
|
cc @NaridaL |
This file contains hidden or 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
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.
Proposed changes
SVGPathData#clone(): copies every command withCLONE(), asCALCULATE_BOUNDSdoes, so a copy can be transformed without touching the original.new SVGPathData([...pathData.commands])shares the commands, whichtoAbs()and the other transformers mutate in place (raised by @armano2 in fix(core): keep the holes of evenodd paths svgicons2svgfont#182).src/tests/clone.test.tscovers both directions. Gates as in feat: add evenoddToNonzero to reorient subpaths for the nonzero rule #101.Code quality
contributors
field of the
package.jsonfile. Beware to use the same format than for the author fieldfor the entries so that you'll get a mention in the
README.mdwith a link to your website.License
To get your contribution merged, you must check the following.