diff --git a/lib/extract/extractTransform.js b/lib/extract/extractTransform.js index b7d35dd8..e391a347 100644 --- a/lib/extract/extractTransform.js +++ b/lib/extract/extractTransform.js @@ -39,7 +39,7 @@ function transformToMatrix(props, transform) { console.error(e); } } else { - appendTransform(transform); + appendTransform(props2transform(transform)); } } @@ -49,7 +49,9 @@ function transformToMatrix(props, transform) { function universal2axis(universal, axisX, axisY, defaultValue) { let x; let y; - if (typeof universal === 'string') { + if (typeof universal === 'number') { + x = y = universal; + } else if (typeof universal === 'string') { const coords = universal.split(/\s*,\s*/); if (coords.length === 2) { x = +coords[0]; @@ -57,8 +59,6 @@ function universal2axis(universal, axisX, axisY, defaultValue) { } else if (coords.length === 1) { x = y = +coords[0]; } - } else if (typeof universal === 'number') { - x = y = universal; } axisX = +axisX; @@ -75,9 +75,6 @@ function universal2axis(universal, axisX, axisY, defaultValue) { } export function props2transform(props) { - if (Array.isArray(props) || typeof props === 'string') { - return props; - } const origin = universal2axis(props.origin, props.originX, props.originY); const scale = universal2axis(props.scale, props.scaleX, props.scaleY, 1); const skew = universal2axis(props.skew, props.skewX, props.skewY); @@ -107,7 +104,8 @@ const identity = [1, 0, 0, 1, 0, 0]; export default function extractTransform(props) { if (Array.isArray(props)) { return props; - } else if (typeof props === 'string') { + } + if (typeof props === 'string') { try { const t = transformParser.parse(props); return [t[0], t[3], t[1], t[4], t[2], t[5]]; @@ -116,8 +114,5 @@ export default function extractTransform(props) { return identity; } } - return transformToMatrix( - props2transform(props), - props.transform && props2transform(props.transform), - ); + return transformToMatrix(props2transform(props), props.transform); }