mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-21 14:25:14 +00:00
Improve coordinate system calculations for font-size, letter-spacing etc.
Fix parsing of transform to account for single parameter scale and translate correctly. Fix skewX, had opposite of intended effect. https://www.w3.org/TR/SVG/coords.html https://www.w3.org/TR/SVG2/coords.html https://www.w3.org/TR/SVGTiny12/coords.html https://www.w3.org/TR/SVG/coords.html#TransformAttribute https://www.w3.org/TR/SVG/coords.html#SkewXDefined
This commit is contained in:
@@ -50,11 +50,11 @@ class TransformParser {
|
||||
break;
|
||||
case 'translate':
|
||||
retval.translateX = transLst[i + 1];
|
||||
retval.translateY = (i + 2 <= transLst.length) ? transLst[i + 2] : 0;
|
||||
retval.translateY = (3 === transLst.length) ? transLst[i + 2] : 0;
|
||||
break;
|
||||
case 'scale':
|
||||
retval.scaleX = transLst[i + 1];
|
||||
retval.scaleY = (i + 2 <= transLst.length) ? transLst[i + 2] : retval.scaleX;
|
||||
retval.scaleY = (3 === transLst.length) ? transLst[i + 2] : retval.scaleX;
|
||||
break;
|
||||
case 'rotate':
|
||||
retval.rotation = transLst[i + 1];
|
||||
@@ -85,7 +85,7 @@ class TransformParser {
|
||||
}
|
||||
}
|
||||
|
||||
const tp = new TransformParser();
|
||||
export const tp = new TransformParser();
|
||||
|
||||
|
||||
function appendTransform(transform) {
|
||||
@@ -147,7 +147,7 @@ function universal2axis(universal, axisX, axisY, defaultValue) {
|
||||
return [x || defaultValue || 0, y || defaultValue || 0];
|
||||
}
|
||||
|
||||
function props2transform(props) {
|
||||
export function props2transform(props) {
|
||||
if (props && (typeof props === 'string')) {
|
||||
return props;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user