add some android support

add path for Text
add stroke pattern
add text dashed and fix dasharray bug
This commit is contained in:
Horcrux
2016-04-23 14:44:48 +08:00
parent d990eaa472
commit 05faac3cf1
8 changed files with 148 additions and 111 deletions
+1 -1
View File
@@ -31,13 +31,13 @@ export default function (props) {
if (pattern) {
clippingProps.clipPath = new SerializablePath(pattern).toJSON();
} else {
clippingProps = {};
// TODO: warn
}
} else {
clippingProps.clipPath = new SerializablePath(clipPath).toJSON();
}
}
return clippingProps;
}
+7 -1
View File
@@ -28,15 +28,21 @@ function strokeFilter(props, dimensions) {
strokeDasharray = strokeDasharray.split(separator).map(dash => +dash);
}
// strokeDasharray length must be more than 1.
if (strokeDasharray && strokeDasharray.length === 1) {
strokeDasharray.push(strokeDasharray[0]);
}
if (!stroke) {
stroke = '#000';
}
// TODO: dashoffset
// TODO: propTypes check
return {
stroke: patterns(stroke, +props.strokeOpacity, dimensions, props.svgId),
strokeLinecap: caps[props.strokeLinecap] || 2,
strokeLinecap: caps[props.strokeLinecap] || 0,
strokeLinejoin: joins[props.strokeLinejoin] || 0,
strokeDash: strokeDasharray || null,
strokeWidth: strokeWidth || 1
+5 -8
View File
@@ -82,15 +82,12 @@ const alignments = {
};
export default function(props) {
let textPath = props.path ? new SerializablePath(props.path).toJSON() : null;
var textFrame = extractFontAndLines(
props,
childrenAsString(props.children)
);
return {
alignment: alignments[props.textAnchor] || 0,
frame: textFrame,
path: textPath
frame: extractFontAndLines(
props,
childrenAsString(props.children)
),
path: props.path ? new SerializablePath(props.path).toJSON() : undefined
}
}