Skip to content

feat(convertShapeToPath): convert rect with rounded corners using arcs - #1816

Open
JoCa96 wants to merge 9 commits into
svg:mainfrom
JoCa96:feat-convert-rounded-rect-shape-to-path
Open

feat(convertShapeToPath): convert rect with rounded corners using arcs #1816
JoCa96 wants to merge 9 commits into
svg:mainfrom
JoCa96:feat-convert-rounded-rect-shape-to-path

Conversation

@JoCa96

@JoCa96 JoCa96 commented Nov 3, 2023

Copy link
Copy Markdown

Convert rect shape with a defined rx and/or ry to path when the convertArcs parameter is true.

E.g.

<rect x="40" y="50" width="30" height="20" rx="2" ry="5"/>

will become

<path d="M68 50A2 5 0 0 1 70 55L70 65A2 5 0 0 1 68 70L42 70A2 5 0 0 1 40 65L40 55A2 5 0 0 1 42 50z"/>

When rx and ry are invalid or 0 the conversion will be performed without arcs as there are no rounded corners in that case.

@KTibow

KTibow commented Nov 4, 2023

Copy link
Copy Markdown
Collaborator

why would you want to do this? this seems like the opposite of optimization

@JoCa96

JoCa96 commented Nov 4, 2023

Copy link
Copy Markdown
Author

why would you want to do this? this seems like the opposite of optimization

That's true for all conversions that are enabled by the convertArcs flag.

The need for this is use-case dependant.
If the flag is enabled it should do all the arc conversions imho. We want to reduce all shapes to a single path. You can also see the need for this in PR #1767.

@jguddas

jguddas commented Nov 12, 2023

Copy link
Copy Markdown

This is basically the opposite of #1748, there are definitely cases where one is closer than the other.

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.

3 participants