Skip to content

Commit

Permalink
Fix for edge markers displaying above nodes when using elk
Browse files Browse the repository at this point in the history
  • Loading branch information
yari-dewalt committed Oct 18, 2024
1 parent c789172 commit b67cdb1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/mermaid/src/diagrams/er/erRenderer-unified.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ export const draw = async function (text: string, id: string, _version: string,
data4Layout.markers = ['only_one', 'zero_or_one', 'one_or_more', 'zero_or_more'];
data4Layout.diagramId = id;
await render(data4Layout, svg);
// Elk layout algorithm displays markers above nodes, so cut off the half that covers the node for the larger markers.
// Elk layout algorithm displays markers above nodes, so move edges to top so they are "painted" over by the nodes.
if (data4Layout.layoutAlgorithm === 'elk') {
svg.selectAll('*[id*="oneOrMoreStart"]').attr('viewBox', '18 0 38.5 36');
svg.selectAll('*[id*="oneOrMoreEnd"]').attr('viewBox', '0 0 27 36');
svg.selectAll('*[id*="zeroOrMoreStart"]').attr('viewBox', '18 0 38.5 36');
svg.selectAll('*[id*="zeroOrMoreEnd"]').attr('viewBox', '0 0 38.5 36');
svg.select('.edges').lower();
}
const padding = 8;
utils.insertTitle(
Expand Down

0 comments on commit b67cdb1

Please sign in to comment.