refactor: Unify the edgeMarker adding logic

This commit is contained in:
Sidharth Vinod 2023-09-14 15:25:52 +05:30
parent 29e5e66481
commit faa1fda7ba
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
2 changed files with 4 additions and 6 deletions

View File

@ -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 = {};
@ -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) {

View File

@ -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();
@ -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);
};
/**