Fix startOfRendering calculation. Fix cursor position calculation. Refactor extractStroke strokeWidth handling.

This commit is contained in:
Mikael Sand
2017-07-29 14:42:06 +03:00
parent 36595c91e2
commit 3825bbd5c8
3 changed files with 16 additions and 12 deletions
+8 -3
View File
@@ -26,7 +26,7 @@ export default function(props, styleProperties) {
});
const {stroke} = props;
const strokeWidth = props.strokeWidth;
let strokeWidth = props.strokeWidth;
let strokeDasharray = props.strokeDasharray;
if (!strokeDasharray || strokeDasharray === 'none') {
@@ -43,14 +43,19 @@ export default function(props, styleProperties) {
strokeDasharray.concat(strokeDasharray);
}
if (!strokeWidth || typeof strokeWidth !== 'string') {
strokeWidth = `${strokeWidth || 1}`;
}
return {
stroke: extractBrush(stroke),
strokeOpacity: extractOpacity(props.strokeOpacity),
strokeLinecap: caps[props.strokeLinecap] || 0,
strokeLinejoin: joins[props.strokeLinejoin] || 0,
strokeDasharray: strokeDasharray,
strokeWidth: `${strokeWidth || 1}`,
strokeWidth: strokeWidth,
strokeDashoffset: strokeDasharray ? (+props.strokeDashoffset || 0) : null,
strokeMiterlimit: props.strokeMiterlimit || 4
strokeMiterlimit: props.strokeMiterlimit || 4,
};
}