mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-03 12:25:22 +01:00
#5237 Fix for issue from failing test, self loops to/from clusters
This commit is contained in:
@@ -320,7 +320,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
domId: specialId1,
|
||||
id: specialId1,
|
||||
labelStyle: '',
|
||||
label: edge.label,
|
||||
label: '',
|
||||
padding: 0,
|
||||
shape: 'labelRect',
|
||||
style: '',
|
||||
@@ -342,14 +342,16 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
const edge2 = structuredClone(edge);
|
||||
edge1.label = '';
|
||||
edge1.arrowTypeEnd = 'none';
|
||||
edge1.id = e.name + '-cyclic-special-1';
|
||||
edgeMid.arrowTypeEnd = 'none';
|
||||
edgeMid.id = e.name + '-cyclic-special-mid';
|
||||
edge2.label = '';
|
||||
edge1.fromCluster = e.v;
|
||||
edge2.toCluster = e.v;
|
||||
|
||||
graph.setEdge(v, specialId1, edge1, e.name + '-cyclic-special');
|
||||
graph.setEdge(specialId1, specialId2, edgeMid, e.name + '-cyclic-special');
|
||||
graph.setEdge(specialId2, w, edge2, e.name + '-cyclic-special');
|
||||
edge2.id = e.name + '-cyclic-special-2';
|
||||
graph.setEdge(v, specialId1, edge1, e.name + '-cyclic-special-0');
|
||||
graph.setEdge(specialId1, specialId2, edgeMid, e.name + '-cyclic-special-1');
|
||||
graph.setEdge(specialId2, w, edge2, e.name + '-cyclic-special-2');
|
||||
} else if (clusterDb[e.v] || clusterDb[e.w]) {
|
||||
log.warn('Fixing and trixing - removing XXX', e.v, e.w, e.name);
|
||||
v = getAnchorId(e.v);
|
||||
@@ -375,7 +377,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
|
||||
log.trace(clusterDb);
|
||||
|
||||
// Remove references to extracted cluster
|
||||
// graph.edges().forEach(edge => {
|
||||
// graph.edges().forEach((edge) => {
|
||||
// if (isDescendant(edge.v, clusterId) || isDescendant(edge.w, clusterId)) {
|
||||
// graph.removeEdge(edge);
|
||||
// }
|
||||
|
||||
@@ -23,8 +23,8 @@ export const labelRect = async (parent: SVGElement, node: Node) => {
|
||||
const rect = shapeSvg.insert('rect', ':first-child');
|
||||
|
||||
// Hide the rect we are only after the label
|
||||
const totalWidth = 0;
|
||||
const totalHeight = 0;
|
||||
const totalWidth = 0.1;
|
||||
const totalHeight = 0.1;
|
||||
rect.attr('width', totalWidth).attr('height', totalHeight);
|
||||
shapeSvg.attr('class', 'label edgeLabel');
|
||||
|
||||
@@ -40,6 +40,8 @@ export const labelRect = async (parent: SVGElement, node: Node) => {
|
||||
// }
|
||||
|
||||
updateNodeBounds(node, rect);
|
||||
// node.width = 1;
|
||||
// node.height = 1;
|
||||
|
||||
node.intersect = function (point) {
|
||||
return intersect.rect(node, point);
|
||||
|
||||
Reference in New Issue
Block a user