mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-15 13:29:40 +02:00
#1386 Adding subroutine support for new rendering engine
This commit is contained in:
@@ -40,22 +40,8 @@
|
|||||||
G-->c
|
G-->c
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid" style="width: 50%; height: 20%;">
|
<div class="mermaid" style="width: 50%; height: 20%;">
|
||||||
stateDiagram-v2
|
flowchart LR
|
||||||
[*] --> First
|
id1[[This is the text in the box]]
|
||||||
|
|
||||||
state First {
|
|
||||||
[*] --> Second
|
|
||||||
|
|
||||||
state Second {
|
|
||||||
[*] --> second
|
|
||||||
second --> Third
|
|
||||||
|
|
||||||
state Third {
|
|
||||||
[*] --> third
|
|
||||||
third --> [*]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid2" style="width: 50%; height: 20%;">
|
<div class="mermaid2" style="width: 50%; height: 20%;">
|
||||||
|
@@ -359,6 +359,40 @@ graph TB
|
|||||||
B --> D
|
B --> D
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Beta: New arrow types
|
||||||
|
|
||||||
|
When using flowchart instead of graph there is the are new types of arrows supported as per below:
|
||||||
|
|
||||||
|
```
|
||||||
|
flowchart LR
|
||||||
|
A --o B
|
||||||
|
B --x C
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
A --o B
|
||||||
|
B --x C
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Beta: multi directional arrows
|
||||||
|
|
||||||
|
When using flowchart instead of graph there is the possibility to use multidirectional arrows.
|
||||||
|
|
||||||
|
```
|
||||||
|
flowchart LR
|
||||||
|
A o--o B
|
||||||
|
B <--> C
|
||||||
|
C x--x D
|
||||||
|
```
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
A o--o B
|
||||||
|
B <--> C
|
||||||
|
C x--x D
|
||||||
|
```
|
||||||
|
|
||||||
## Special characters that break syntax
|
## Special characters that break syntax
|
||||||
|
|
||||||
|
@@ -384,6 +384,34 @@ const circle = (parent, node) => {
|
|||||||
|
|
||||||
return shapeSvg;
|
return shapeSvg;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const subroutine = (parent, node) => {
|
||||||
|
const { shapeSvg, bbox } = labelHelper(parent, node);
|
||||||
|
|
||||||
|
const w = bbox.width + node.padding;
|
||||||
|
const h = bbox.height + node.padding;
|
||||||
|
const points = [
|
||||||
|
{ x: 0, y: 0 },
|
||||||
|
{ x: w, y: 0 },
|
||||||
|
{ x: w, y: -h },
|
||||||
|
{ x: 0, y: -h },
|
||||||
|
{ x: 0, y: 0 },
|
||||||
|
{ x: -8, y: 0 },
|
||||||
|
{ x: w + 8, y: 0 },
|
||||||
|
{ x: w + 8, y: -h },
|
||||||
|
{ x: -8, y: -h },
|
||||||
|
{ x: -8, y: 0 }
|
||||||
|
];
|
||||||
|
const el = insertPolygonShape(shapeSvg, w, h, points);
|
||||||
|
updateNodeBounds(node, el);
|
||||||
|
|
||||||
|
node.intersect = function(point) {
|
||||||
|
return intersect.polygon(node, point);
|
||||||
|
};
|
||||||
|
|
||||||
|
return shapeSvg;
|
||||||
|
};
|
||||||
|
|
||||||
const start = (parent, node) => {
|
const start = (parent, node) => {
|
||||||
const shapeSvg = parent
|
const shapeSvg = parent
|
||||||
.insert('g')
|
.insert('g')
|
||||||
@@ -487,6 +515,7 @@ const shapes = {
|
|||||||
start,
|
start,
|
||||||
end,
|
end,
|
||||||
note,
|
note,
|
||||||
|
subroutine,
|
||||||
fork: forkJoin,
|
fork: forkJoin,
|
||||||
join: forkJoin
|
join: forkJoin
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user