diff options
Diffstat (limited to 'frontend/views/graph/components/graph.editor.js')
| -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 |
