Skip to content

Commit

Permalink
Fix auto-viewbox parsers
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore committed Sep 4, 2024
1 parent 725f76e commit 465f78a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions source/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ export const resetIconPosition = (path, iconWidth, iconHeight) => {
const betterOffset = (betterViewboxWidth - actualViewboxWidth) / 2;
const pathRescale = iconWidth > iconHeight
? svgpath(path).scale(scale)
: path;
: svgpath(path);
const [offsetX, offsetY] = svgPathBbox(pathRescale);
const pathReset = svgpath(pathRescale).translate(
const pathReset = pathRescale.translate(
-offsetX + betterOffset,
-offsetY,
)
Expand All @@ -66,6 +66,7 @@ export const getIconSvg = (
iconWidth,
iconHeight,
);

iconSvg = iconSvg
.replace(
'viewBox="0 0 24 24"',
Expand Down

0 comments on commit 465f78a

Please sign in to comment.