svgo
svgo copied to clipboard
[convertPath]: combine arcs and convert full arcs to circles
Is your feature request related to a problem? Please describe. There is already logic that merges curves into arcs, but it only works with curves and not a mix of curves and arcs.
Describe the solution you'd like
- Convert all arcs with
rx == ry
to curves before running the curve merge logic - Convert all curves to arcs and replace the curve merge logic with an arc merge variant.
Additional context Also, 2 half circles could be converted to a circle element. This could use the same logic, but might be better placed in a separate plugin.
- <path d="M8 10a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"/>
+ <circle cx="8" cy="8" r="2"/>
@SethFalco I have a working version here, code is not in the shape svgo expects and a bit of a mess tho.
Example: https://lucide-site-git-feat-added-edit-page-jguddas.vercel.app/edit
Is this intended?
gets optimized to
@KTibow Looks like you found a bug, did a quick test, that bug only exists in the deployed version.
I haven't had the time to clean things up and deploy the newest version, I can reproduce it on the hosted version but locally (with the code in the branch that I have linked) it works.
There is a trick to do circles with one arc instead of two arcs by making a tiny step like 0.01 pixel. It makes even shorter paths than circle.