From 1741f63b41d365024191e3819334411e4d5dcbec Mon Sep 17 00:00:00 2001 From: Horcrux Date: Sun, 24 Apr 2016 00:00:58 +0800 Subject: [PATCH] fix line strokeLinecap bug #11 fix line strokeLinecap bug #11 --- Example/examples/Line.js | 41 +++++++++++++++++++++++++++++++++++- elements/Line.js | 6 ++---- lib/extract/extractStroke.js | 1 - 3 files changed, 42 insertions(+), 6 deletions(-) diff --git a/Example/examples/Line.js b/Example/examples/Line.js index 6bafdbe4..096e0b6d 100644 --- a/Example/examples/Line.js +++ b/Example/examples/Line.js @@ -26,6 +26,45 @@ class LineExample extends Component{ } } +class LineWithStrokeLinecap extends Component{ + static title = 'Line'; + + render() { + return + + + + ; + } +} + const icon = ; -const samples = [LineExample]; +const samples = [LineExample, LineWithStrokeLinecap]; export { icon, diff --git a/elements/Line.js b/elements/Line.js index bb41d19a..64a814c0 100644 --- a/elements/Line.js +++ b/elements/Line.js @@ -14,18 +14,16 @@ class Line extends Component{ x2: propType, y1: propType, y2: propType, - strokeLinecap: PropTypes.oneOf(['butt', 'square', 'round']), - strokeCap: PropTypes.oneOf(['butt', 'square', 'round']) + strokeLinecap: PropTypes.oneOf(['butt', 'square', 'round']) }; static getPath = (props) => ( - `M${props.x1},${props.y1}L${props.x2},${props.y2}Z` + `M${props.x1},${props.y1} L${props.x2},${props.y2}` ); render() { return ; } diff --git a/lib/extract/extractStroke.js b/lib/extract/extractStroke.js index 680ba79e..6477e6bc 100644 --- a/lib/extract/extractStroke.js +++ b/lib/extract/extractStroke.js @@ -37,7 +37,6 @@ function strokeFilter(props, dimensions) { stroke = '#000'; } - // TODO: propTypes check return { stroke: patterns(stroke, +props.strokeOpacity, dimensions, props.svgId),