From 25417eea7b53f0346985e38409af209f4736b4b0 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 7 Jun 2020 16:57:06 +0200 Subject: adjust arrow endpoint --- frontend/views/graph/components/graph.editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'frontend/views/graph/components/graph.editor.js') diff --git a/frontend/views/graph/components/graph.editor.js b/frontend/views/graph/components/graph.editor.js index c21c624..a6d46d4 100644 --- a/frontend/views/graph/components/graph.editor.js +++ b/frontend/views/graph/components/graph.editor.js @@ -245,14 +245,18 @@ class GraphCanvas extends Component { const dy = y2 - y1 const angle = Math.atan2(dy, dx) const farOffset = 20 + const endOffset = 1 x1 += Math.cos(angle) * 0 x2 -= Math.cos(angle) * farOffset y1 += Math.sin(angle) * 0 y2 -= Math.sin(angle) * farOffset + const xEnd = x2 - Math.cos(angle) * endOffset + const yEnd = y2 - Math.sin(angle) * endOffset const leftAngle = mod(angle - Math.PI / 6, Math.PI * 2) const rightAngle = mod(angle + Math.PI / 6, Math.PI * 2) ctx.moveTo(x1, y1) - ctx.lineTo(x2, y2) + ctx.lineTo(xEnd, yEnd) + ctx.moveTo(x2, y2) ctx.lineTo(x2 - headlen * Math.cos(leftAngle), y2 - headlen * Math.sin(leftAngle)) ctx.moveTo(x2, y2) ctx.lineTo(x2 - headlen * Math.cos(rightAngle), y2 - headlen * Math.sin(rightAngle)) -- cgit v1.2.3-70-g09d2