From dc3db3a63dbef059949e8aaa2cec60ca3f2c17dc Mon Sep 17 00:00:00 2001 From: Franc Camps-Febrer Date: Fri, 1 Feb 2019 10:41:53 -0500 Subject: [PATCH] Some cleanup --- .../presentational/Map/Narratives.jsx | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/src/components/presentational/Map/Narratives.jsx b/src/components/presentational/Map/Narratives.jsx index 9e9f9e4..e73f77f 100644 --- a/src/components/presentational/Map/Narratives.jsx +++ b/src/components/presentational/Map/Narratives.jsx @@ -61,8 +61,7 @@ function MapNarratives ({ styles, onSelectNarrative, svg, narrative, narratives, } } - function _renderNarrativeStep (p1, p2, styles) { - const { stroke, strokeWidth, strokeDasharray, strokeOpacity } = styles + function _renderNarrativeStepArrow (p1, p2, styles) { const distance = Math.sqrt((p2.x - p1.x) * (p2.x - p1.x) + (p2.y - p1.y) * (p2.y - p1.y)) const theta = Math.atan2(p2.y - p1.y, p2.x - p1.x) // Angle of narrative step line const alpha = Math.atan2(1, 2) // Angle of arrow overture @@ -82,7 +81,24 @@ function MapNarratives ({ styles, onSelectNarrative, svg, narrative, narratives, x: coord0.x - edge * Math.cos(-theta + alpha), y: coord0.y + edge * Math.sin(-theta + alpha) } - + + return () + } + + function _renderNarrativeStep (p1, p2, styles) { + const { stroke, strokeWidth, strokeDasharray, strokeOpacity } = styles return ( @@ -102,22 +118,7 @@ function MapNarratives ({ styles, onSelectNarrative, svg, narrative, narratives, }} /> {(stroke !== 'none') - ? () + ? _renderNarrativeStepArrow(p1, p2, styles) : '' }