summaryrefslogtreecommitdiff
path: root/frontend/views/graph/components/graph.editor.js
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-06-07 16:57:06 +0200
committerJules Laplace <julescarbon@gmail.com>2020-06-07 16:57:06 +0200
commit25417eea7b53f0346985e38409af209f4736b4b0 (patch)
treeb6fed39c0aa791eb4aa9331ba6ea19e9e9e3deef /frontend/views/graph/components/graph.editor.js
parent9041401b73f93228cc9b5183a9ef30e5f7f171a6 (diff)
adjust arrow endpoint
Diffstat (limited to 'frontend/views/graph/components/graph.editor.js')
-rw-r--r--frontend/views/graph/components/graph.editor.js6
1 files changed, 5 insertions, 1 deletions
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))