mirror of
https://github.com/iconify/iconify.git
synced 2024-12-04 18:23:17 +00:00
chore(utils): handle scaling correctly in loader utils
This commit is contained in:
parent
e633a41e55
commit
412c8119b0
@ -3,7 +3,7 @@
|
||||
"type": "module",
|
||||
"description": "Common functions for working with Iconify icon sets used by various packages.",
|
||||
"author": "Vjacheslav Trushkin",
|
||||
"version": "2.1.28",
|
||||
"version": "2.1.29",
|
||||
"license": "MIT",
|
||||
"bugs": "https://github.com/iconify/iconify/issues",
|
||||
"homepage": "https://iconify.design/docs/libraries/utils/",
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { Awaitable } from '@antfu/utils';
|
||||
import { isUnsetKeyword } from '../svg/build';
|
||||
import { calculateSize } from '../svg/size';
|
||||
import type { IconifyLoaderOptions } from './types';
|
||||
|
||||
const svgWidthRegex = /\swidth\s*=\s*["']([\w.]+)["']/;
|
||||
@ -23,7 +24,11 @@ function configureSvgSize(
|
||||
if (typeof scale === 'number') {
|
||||
// Scale icon, unless scale is 0
|
||||
if (scale > 0) {
|
||||
props[prop] = `${scale}em`;
|
||||
props[prop] = calculateSize(
|
||||
// Base on result from iconToSVG() or 1em
|
||||
result?.[1] ?? '1em',
|
||||
scale
|
||||
);
|
||||
}
|
||||
} else if (result) {
|
||||
// Use result from iconToSVG()
|
||||
|
Loading…
Reference in New Issue
Block a user