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 } }
|
{ 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.y1 ||
|
||||||
outsidePoint.y === edges.y2
|
outsidePoint.y === edges.y2
|
||||||
) {
|
) {
|
||||||
// logger.warn('calc equals on edge');
|
logger.warn('calc equals on edge');
|
||||||
return outsidePoint;
|
return outsidePoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,9 +181,18 @@ export const insertEdge = function(elem, e, edge, clusterDb, diagramType, graph)
|
|||||||
logger.trace('inside', edge.toCluster, point, lastPointOutside);
|
logger.trace('inside', edge.toCluster, point, lastPointOutside);
|
||||||
|
|
||||||
// First point inside the rect
|
// First point inside the rect
|
||||||
const insterection = intersection(node, lastPointOutside, point);
|
const inter = intersection(node, lastPointOutside, point);
|
||||||
logger.trace('intersect', insterection);
|
|
||||||
points.push(insterection);
|
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;
|
isInside = true;
|
||||||
} else {
|
} else {
|
||||||
if (!isInside) points.push(point);
|
if (!isInside) points.push(point);
|
||||||
|
@ -523,7 +523,7 @@ function updateRendererConfigs(conf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function reinitialize(options) {
|
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]) {
|
if (options.theme && themes[options.theme]) {
|
||||||
// Todo merge with user options
|
// Todo merge with user options
|
||||||
options.themeVariables = themes[options.theme].getThemeVariables(options.themeVariables);
|
options.themeVariables = themes[options.theme].getThemeVariables(options.themeVariables);
|
||||||
@ -537,7 +537,7 @@ function reinitialize(options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function initialize(options) {
|
function initialize(options) {
|
||||||
console.log(`mermaidAPI.initialize: v${pkg.version} ${options}`);
|
// console.log(`mermaidAPI.initialize: v${pkg.version} ${options}`);
|
||||||
// Set default options
|
// Set default options
|
||||||
|
|
||||||
if (options && options.theme && themes[options.theme]) {
|
if (options && options.theme && themes[options.theme]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user