diff --git a/cypress/integration/rendering/flowchart-v2.spec.js b/cypress/integration/rendering/flowchart-v2.spec.js index 222f8d74c..9644f5703 100644 --- a/cypress/integration/rendering/flowchart-v2.spec.js +++ b/cypress/integration/rendering/flowchart-v2.spec.js @@ -28,4 +28,22 @@ describe('Flowchart v2', () => { { flowchart: { diagramPadding: 0 } } ); }); + + it('3: a link with correct arrowhead to a subgraph', () => { + imgSnapshotTest( + `flowchart TD + P1 + P1 -->P1.5 + subgraph P1.5 + P2 + P2.5(( A )) + P3 + end + P2 --> P4 + P3 --> P6 + P1.5 --> P5 + `, + { flowchart: { diagramPadding: 0 } } + ); + }); diff --git a/src/dagre-wrapper/edges.js b/src/dagre-wrapper/edges.js index 85f7d2849..ce11fdc56 100644 --- a/src/dagre-wrapper/edges.js +++ b/src/dagre-wrapper/edges.js @@ -107,7 +107,7 @@ export const intersection = (node, outsidePoint, insidePoint) => { outsidePoint.y === edges.y1 || outsidePoint.y === edges.y2 ) { - // logger.warn('calc equals on edge'); + logger.warn('calc equals on edge'); return outsidePoint; } @@ -181,9 +181,18 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph) logger.trace('inside', edge.toCluster, point, lastPointOutside); // First point inside the rect - const insterection = intersection(node, lastPointOutside, point); - logger.trace('intersect', insterection); - points.push(insterection); + const inter = intersection(node, lastPointOutside, point); + + let pointPresent = false; + points.forEach(p => { + pointPresent = pointPresent || (p.x === inter.x && p.y === inter.y); + }); + // if (!pointPresent) { + if (!points.find(e => e.x === inter.x && e.y === inter.y)) { + points.push(inter); + } else { + logger.warn('no intersect', inter, points); + } isInside = true; } else { if (!isInside) points.push(point); diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 74a8ffc64..1b2e91da2 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -523,7 +523,7 @@ function updateRendererConfigs(conf) { } function reinitialize(options) { - console.warn(`mermaidAPI.reinitialize: v${pkg.version}`, options); + // console.warn(`mermaidAPI.reinitialize: v${pkg.version}`, options); if (options.theme && themes[options.theme]) { // Todo merge with user options options.themeVariables = themes[options.theme].getThemeVariables(options.themeVariables); @@ -537,7 +537,7 @@ function reinitialize(options) { } function initialize(options) { - console.log(`mermaidAPI.initialize: v${pkg.version} ${options}`); + // console.log(`mermaidAPI.initialize: v${pkg.version} ${options}`); // Set default options if (options && options.theme && themes[options.theme]) {