mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Added parallelograms.
This commit is contained in:
parent
99169398b7
commit
03abeacea4
4
dist/index.html
vendored
4
dist/index.html
vendored
@ -109,8 +109,8 @@
|
||||
A[/Christmas\]
|
||||
A -->|Get money| B[\Go shopping/]
|
||||
B --> C{Let me thinksssss<br/>ssssssssssssssssssssss<br/>sssssssssssssssssssssssssss}
|
||||
C -->|One| D[Laptop]
|
||||
C -->|Two| E[iPhone]
|
||||
C -->|One| D[/Laptop/]
|
||||
C -->|Two| E[\iPhone\]
|
||||
C -->|Three| F[Car]
|
||||
</div>
|
||||
<div class="mermaid">
|
||||
|
@ -110,6 +110,12 @@ export const addVertices = function (vert, g, svgId) {
|
||||
case 'odd':
|
||||
_shape = 'rect_left_inv_arrow'
|
||||
break
|
||||
case 'lean_right':
|
||||
_shape = 'lean_right'
|
||||
break
|
||||
case 'lean_left':
|
||||
_shape = 'lean_left'
|
||||
break
|
||||
case 'trapezoid':
|
||||
_shape = 'trapezoid'
|
||||
break
|
||||
@ -344,12 +350,54 @@ export const draw = function (text, id) {
|
||||
return shapeSvg
|
||||
}
|
||||
|
||||
// Add custom shape for box with inverted arrow on left side
|
||||
render.shapes().lean_right = function (parent, bbox, node) {
|
||||
const w = bbox.width
|
||||
const h = bbox.height
|
||||
const points = [
|
||||
{ x: -2 * h / 6, y: 0 },
|
||||
{ x: w - h / 6, y: 0 },
|
||||
{ x: w + 2 * h / 6, y: -h },
|
||||
{ x: h / 6, y: -h }
|
||||
]
|
||||
const shapeSvg = parent.insert('polygon', ':first-child')
|
||||
.attr('points', points.map(function (d) {
|
||||
return d.x + ',' + d.y
|
||||
}).join(' '))
|
||||
.attr('transform', 'translate(' + (-w / 2) + ',' + (h * 2 / 4) + ')')
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point)
|
||||
}
|
||||
return shapeSvg
|
||||
}
|
||||
|
||||
// Add custom shape for box with inverted arrow on left side
|
||||
render.shapes().lean_left = function (parent, bbox, node) {
|
||||
const w = bbox.width
|
||||
const h = bbox.height
|
||||
const points = [
|
||||
{ x: 2 * h / 6, y: 0 },
|
||||
{ x: w + h / 6, y: 0 },
|
||||
{ x: w - 2 * h / 6, y: -h },
|
||||
{ x: -h / 6, y: -h }
|
||||
]
|
||||
const shapeSvg = parent.insert('polygon', ':first-child')
|
||||
.attr('points', points.map(function (d) {
|
||||
return d.x + ',' + d.y
|
||||
}).join(' '))
|
||||
.attr('transform', 'translate(' + (-w / 2) + ',' + (h * 2 / 4) + ')')
|
||||
node.intersect = function (point) {
|
||||
return dagreD3.intersect.polygon(node, points, point)
|
||||
}
|
||||
return shapeSvg
|
||||
}
|
||||
|
||||
// Add custom shape for box with inverted arrow on left side
|
||||
render.shapes().trapezoid = function (parent, bbox, node) {
|
||||
const w = bbox.width
|
||||
const h = bbox.height
|
||||
const points = [
|
||||
{ x: - 2 * h / 6, y: 0 },
|
||||
{ x: -2 * h / 6, y: 0 },
|
||||
{ x: w + 2 * h / 6, y: 0 },
|
||||
{ x: w - h / 6, y: -h },
|
||||
{ x: h / 6, y: -h }
|
||||
@ -373,7 +421,7 @@ export const draw = function (text, id) {
|
||||
{ x: h / 6, y: 0 },
|
||||
{ x: w - h / 6, y: 0 },
|
||||
{ x: w + 2 * h / 6, y: -h },
|
||||
{ x: - 2 * h / 6, y: -h }
|
||||
{ x: -2 * h / 6, y: -h }
|
||||
]
|
||||
const shapeSvg = parent.insert('polygon', ':first-child')
|
||||
.attr('points', points.map(function (d) {
|
||||
|
@ -280,6 +280,14 @@ vertex: alphaNum SQS text SQE
|
||||
{$$ = $1;yy.addVertex($1,$3,'inv_trapezoid');}
|
||||
| alphaNum INVTRAPSTART text INVTRAPEND spaceList
|
||||
{$$ = $1;yy.addVertex($1,$3,'inv_trapezoid');}
|
||||
| alphaNum TRAPSTART text INVTRAPEND
|
||||
{$$ = $1;yy.addVertex($1,$3,'lean_right');}
|
||||
| alphaNum TRAPSTART text INVTRAPEND spaceList
|
||||
{$$ = $1;yy.addVertex($1,$3,'lean_right');}
|
||||
| alphaNum INVTRAPSTART text TRAPEND
|
||||
{$$ = $1;yy.addVertex($1,$3,'lean_left');}
|
||||
| alphaNum INVTRAPSTART text TRAPEND spaceList
|
||||
{$$ = $1;yy.addVertex($1,$3,'lean_left');}
|
||||
/* | alphaNum SQS text TAGSTART
|
||||
{$$ = $1;yy.addVertex($1,$3,'odd_right');}
|
||||
| alphaNum SQS text TAGSTART spaceList
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user