mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
5237 Bugfix for intersect calculation in dagre
This commit is contained in:
parent
5f110e4cde
commit
8cbceb611a
@ -96,7 +96,7 @@ end
|
||||
</pre
|
||||
>
|
||||
<pre id="diagram" class="mermaid">
|
||||
flowchart LR
|
||||
flowchart RL
|
||||
subgraph Apa["Apa"]
|
||||
subgraph Gorilla
|
||||
A["Start"]
|
||||
@ -200,12 +200,12 @@ flowchart LR
|
||||
if_state --> True : if n >= 0
|
||||
</pre
|
||||
>
|
||||
<pre id="diagram" class="mermaid2">
|
||||
<pre id="diagram" class="mermaid">
|
||||
%%{init: {"layout": "dagre", "mergeEdges": true} }%%
|
||||
stateDiagram
|
||||
direction TB
|
||||
State T1 {
|
||||
T11 --> T12
|
||||
T12--> T11
|
||||
}
|
||||
T1 --> T2
|
||||
T11 --> T2
|
||||
@ -221,16 +221,17 @@ State T1 {
|
||||
}
|
||||
</pre
|
||||
>
|
||||
<pre id="diagram" class="mermaid2">
|
||||
%%{init: {"layout": "elk", "mergeEdges": true} }%%
|
||||
stateDiagram
|
||||
direction TB
|
||||
State T1 {
|
||||
T11
|
||||
<pre id="diagram" class="mermaid">
|
||||
%%{init: {"layouts": "elk2", "mergeEdges": true} }%%
|
||||
stateDiagram
|
||||
State S1 {
|
||||
direction TB
|
||||
S11
|
||||
}
|
||||
S1 --> S2
|
||||
</pre
|
||||
>
|
||||
<pre id="diagram" class="mermaid2">
|
||||
<pre id="diagram" class="mermaid">
|
||||
%%{init: {"layout": "elk", "mergeEdges": true} }%%
|
||||
stateDiagram
|
||||
State T1 {
|
||||
@ -240,7 +241,7 @@ State T1 {
|
||||
}
|
||||
</pre
|
||||
>
|
||||
<pre id="diagram" class="mermaid2">
|
||||
<pre id="diagram" class="mermaid">
|
||||
%%{init: {"layout": "elk", "mergeEdges": true} }%%
|
||||
stateDiagram
|
||||
[*] --> T1
|
||||
@ -294,7 +295,7 @@ stateDiagram-v2
|
||||
// handdrawnSeed: 12,
|
||||
// look: 'handdrawn',
|
||||
// 'elk.nodePlacement.strategy': 'NETWORK_SIMPLEX',
|
||||
// layout: 'dagre',
|
||||
layout: 'dagre',
|
||||
// layout: 'elk',
|
||||
// layout: 'fixed',
|
||||
// htmlLabels: false,
|
||||
|
@ -162,7 +162,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
|
||||
node.x -= 8;
|
||||
|
||||
log.info(
|
||||
'A tainted cluster node XBX',
|
||||
'A pure cluster node XBX',
|
||||
v,
|
||||
node.id,
|
||||
node.width,
|
||||
@ -188,7 +188,7 @@ const recursiveRender = async (_elem, graph, diagramType, id, parentCluster, sit
|
||||
|
||||
// A cluster in the non-recursive way
|
||||
log.info(
|
||||
'A pure cluster node with children XBX',
|
||||
'A tainted cluster node with children XBX',
|
||||
v,
|
||||
node.id,
|
||||
node.width,
|
||||
|
@ -272,7 +272,6 @@ export const intersection = (node, outsidePoint, insidePoint) => {
|
||||
// log.warn();
|
||||
if (Math.abs(y - outsidePoint.y) * w > Math.abs(x - outsidePoint.x) * h) {
|
||||
// Intersection is top or bottom of rect.
|
||||
// let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
||||
let q = insidePoint.y < outsidePoint.y ? outsidePoint.y - h - y : y - h - outsidePoint.y;
|
||||
r = (R * q) / Q;
|
||||
const res = {
|
||||
@ -280,10 +279,10 @@ export const intersection = (node, outsidePoint, insidePoint) => {
|
||||
y: insidePoint.y < outsidePoint.y ? insidePoint.y + Q - q : insidePoint.y - Q + q,
|
||||
};
|
||||
|
||||
if (r === 0) {
|
||||
res.x = outsidePoint.x;
|
||||
res.y = outsidePoint.y;
|
||||
}
|
||||
// if (r === 0) {
|
||||
// res.x = outsidePoint.x;
|
||||
// res.y = outsidePoint.y;
|
||||
// }
|
||||
if (R === 0) {
|
||||
res.x = outsidePoint.x;
|
||||
}
|
||||
@ -291,7 +290,7 @@ export const intersection = (node, outsidePoint, insidePoint) => {
|
||||
res.y = outsidePoint.y;
|
||||
}
|
||||
|
||||
log.warn(`abc89 top/bot calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res);
|
||||
log.warn(`abc89 top/bot calc, Q ${Q}, q ${q}, R ${R}, r ${r}`, res, 'apa');
|
||||
|
||||
return res;
|
||||
} else {
|
||||
@ -346,7 +345,7 @@ const cutPathAtIntersect = (_points, boundaryNode) => {
|
||||
// Calc the intersection coord between the point anf the last point outside the rect
|
||||
const inter = intersection(boundaryNode, lastPointOutside, point);
|
||||
log.warn('abc88 inside', point, lastPointOutside, inter);
|
||||
log.warn('abc88 intersection', inter);
|
||||
log.warn('abc88 intersection', inter, boundaryNode);
|
||||
|
||||
// // Check case where the intersection is the same as the last point
|
||||
let pointPresent = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user