diff --git a/lib/svgo/tools.js b/lib/svgo/tools.js index 6bd9b69e6..514c667ac 100644 --- a/lib/svgo/tools.js +++ b/lib/svgo/tools.js @@ -193,11 +193,12 @@ export const includesUrlReference = (body) => { }; /** - * Checks if changing the path would cause the element to look different. + * Checks if changing the position or size of an element would + * cause the element to look different. * @param {import('../types.js').ComputedStyles} computedStyle - * @returns {boolean} If it's safe to change the path. + * @returns {boolean} If it's safe to change the position. */ -export const canChangePath = (computedStyle) => { +export const canChangePosition = (computedStyle) => { if (computedStyle['marker-start']) return false; if (computedStyle['marker-mid']) return false; if (computedStyle['marker-end']) return false; diff --git a/plugins/applyTransformsShapes.js b/plugins/applyTransformsShapes.js index eb1b838d2..5762de7a5 100644 --- a/plugins/applyTransformsShapes.js +++ b/plugins/applyTransformsShapes.js @@ -2,7 +2,7 @@ import { collectStylesheet, computeStyle } from '../lib/style.js'; import { toFixed, removeLeadingZero, - canChangePath, + canChangePosition, } from '../lib/svgo/tools.js'; import { attrsGroupsDefaults } from './_collections.js'; import { transform2js, transformsMultiply } from './_transforms.js'; diff --git a/plugins/mergePaths.js b/plugins/mergePaths.js index 1453723a2..bb4172ae6 100644 --- a/plugins/mergePaths.js +++ b/plugins/mergePaths.js @@ -9,7 +9,7 @@ import { collectStylesheet, computeStyle } from '../lib/style.js'; import { path2js, js2path, intersects } from './_path.js'; -import { canChangePath } from '../lib/svgo/tools.js'; +import { canChangePosition } from '../lib/svgo/tools.js'; export const name = 'mergePaths'; export const description = 'merges multiple paths in one if possible'; @@ -83,7 +83,7 @@ export const fn = (root, params) => { } const computedStyle = computeStyle(stylesheet, child); - if (!canChangePath(computedStyle)) { + if (!canChangePosition(computedStyle)) { if (prevPathData) { updatePreviousPath(prevChild, prevPathData); }