Skip to content

Commit

Permalink
Fix translate shorthand and add array support
Browse files Browse the repository at this point in the history
  • Loading branch information
msand authored Apr 19, 2019
1 parent 276a6e9 commit 0835b50
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/extract/extractTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ function universal2axis(universal, axisX, axisY, defaultValue) {
} else if (coords.length === 1) {
x = y = +coords[0];
}
} else if (Array.isArray(universal)) {
if (universal.length === 2) {
x = +universal[0];
y = +universal[1];
} else if (universal.length === 1) {
x = y = +universal[0];
}
}

axisX = +axisX;
Expand All @@ -51,8 +58,8 @@ export function props2transform(props) {
const skew = universal2axis(props.skew, props.skewX, props.skewY);
const translate = universal2axis(
props.translate,
props.translateX == null ? props.x || 0 : props.translateX,
props.translateY == null ? props.y || 0 : props.translateY,
props.translateX || props.x,
props.translateY || props.y,
);

return {
Expand Down

0 comments on commit 0835b50

Please sign in to comment.