diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-06-07 16:57:06 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-06-07 16:57:06 +0200 |
| commit | 25417eea7b53f0346985e38409af209f4736b4b0 (patch) | |
| tree | b6fed39c0aa791eb4aa9331ba6ea19e9e9e3deef /frontend/views | |
| parent | 9041401b73f93228cc9b5183a9ef30e5f7f171a6 (diff) | |
adjust arrow endpoint
Diffstat (limited to 'frontend/views')
| -rw-r--r-- | frontend/views/graph/components/graph.editor.js | 6 |
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)) |
