mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Merge pull request #1563 from mermaid-js/bug/1562_arrowheads_in_edges_to_cluster
Bug/1562 arrowheads in edges to cluster
This commit is contained in:
commit
835a3f6149
@ -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 } }
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@ -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);
|
||||
|
@ -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]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user