mirror of
https://github.com/zoriya/react-native-svg.git
synced 2025-12-20 22:05: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:
@@ -1,6 +1,6 @@
|
||||
import extractFill from './extractFill';
|
||||
import extractStroke from './extractStroke';
|
||||
import extractTransform from './extractTransform';
|
||||
import extractTransform, {props2transform, tp} from './extractTransform';
|
||||
import extractClipPath from './extractClipPath';
|
||||
import extractResponder from './extractResponder';
|
||||
import extractOpacity from './extractOpacity';
|
||||
@@ -26,6 +26,23 @@ export default function(props, ref) {
|
||||
|
||||
extractedProps.matrix = extractTransform(props);
|
||||
|
||||
Object.assign(extractedProps, props2transform(props));
|
||||
let transform = props.transform;
|
||||
if (transform) {
|
||||
if (typeof transform === 'string') {
|
||||
var transformParsed = tp.parse(transform);
|
||||
if (transformParsed.matrix) {
|
||||
// TODO: Extract scaling values for coordinate system
|
||||
// Especially scaleY for calculating scaling of fontSize
|
||||
} else {
|
||||
let trans = props2transform(transformParsed);
|
||||
if (typeof trans === 'object') {
|
||||
Object.assign(extractedProps, trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Object.assign(extractedProps, extractResponder(props, ref));
|
||||
|
||||
return extractedProps;
|
||||
|
||||
Reference in New Issue
Block a user