Skip to content

Commit

Permalink
refactor: Unify the edgeMarker adding logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Sep 14, 2023
1 parent 29e5e66 commit faa1fda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions packages/mermaid/src/dagre-wrapper/edges.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getConfig } from '../config.js';
import utils from '../utils.js';
import { evaluate } from '../diagrams/common/common.js';
import { getLineFunctionsWithOffset } from '../utils/lineWithOffset.js';
import { addEdgeMarker } from './edgeMarker.js';
import { addEdgeMarkers } from './edgeMarker.js';

let edgeLabels = {};
let terminalLabels = {};
Expand Down Expand Up @@ -507,8 +507,7 @@ export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph
log.info('arrowTypeStart', edge.arrowTypeStart);
log.info('arrowTypeEnd', edge.arrowTypeEnd);

addEdgeMarker(svgPath, 'start', edge.arrowTypeStart, url, id, diagramType);
addEdgeMarker(svgPath, 'end', edge.arrowTypeEnd, url, id, diagramType);
addEdgeMarkers(svgPath, edge, url, id, diagramType);

let paths = {};
if (pointsHasChanged) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import common from '../../common/common.js';
import { interpolateToCurve, getStylesFromArray } from '../../../utils.js';
import ELK from 'elkjs/lib/elk.bundled.js';
import { getLineFunctionsWithOffset } from '../../../utils/lineWithOffset.js';
import { addEdgeMarker } from '../../../dagre-wrapper/edgeMarker.js';
import { addEdgeMarkers } from '../../../dagre-wrapper/edgeMarker.js';

const elk = new ELK();

Expand Down Expand Up @@ -587,8 +587,7 @@ const addMarkersToEdge = function (svgPath, edgeData, diagramType, arrowMarkerAb
}

// look in edge data and decide which marker to use
addEdgeMarker(svgPath, 'start', edgeData.arrowTypeStart, url, id, diagramType);
addEdgeMarker(svgPath, 'end', edgeData.arrowTypeEnd, url, id, diagramType);
addEdgeMarkers(svgPath, edgeData, url, id, diagramType);
};

/**
Expand Down

0 comments on commit faa1fda

Please sign in to comment.