diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-06-07 19:34:54 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-06-07 19:34:54 +0200 |
| commit | adf56057ff4f56d8a3b7c1e82422a62a0b047d21 (patch) | |
| tree | 1197d2e7915fd2cdcc73e01efafe16268913ed3c /frontend/views/graph/components | |
| parent | 25417eea7b53f0346985e38409af209f4736b4b0 (diff) | |
tidy lines
Diffstat (limited to 'frontend/views/graph/components')
| -rw-r--r-- | frontend/views/graph/components/graph.editor.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/frontend/views/graph/components/graph.editor.js b/frontend/views/graph/components/graph.editor.js index a6d46d4..c1b3432 100644 --- a/frontend/views/graph/components/graph.editor.js +++ b/frontend/views/graph/components/graph.editor.js @@ -220,13 +220,17 @@ class GraphCanvas extends Component { const targetCoord = coordsLookup[tile.page_id] let xOffset = 16 let yOffset = 16 - // console.log(tile.page_id, tile.target_page_id, sourceCoord.backlinks, targetCoord.backlinks) - if (targetCoord.backlinks.has(tile.target_page_id)) { - xOffset += 10 - ctx.strokeStyle = "#88ffff" - } else { + // skip duplicate links + if (sourceCoord.backlinks.has(tile.page_id)) { + return + } + // if this is the first time encountering this link... + if (!targetCoord.backlinks.has(tile.target_page_id)) { sourceCoord.backlinks.add(tile.page_id) ctx.strokeStyle = "#ff88ff" + } else { // otherwise this is a two-way link + xOffset += 10 + ctx.strokeStyle = "#88ffff" } ctx.beginPath() const x1 = targetCoord.x * width + xOffset |
