Added parallelograms.
This commit is contained in:
parent
99169398b7
commit
03abeacea4
|
@ -109,8 +109,8 @@
|
||||||
A[/Christmas\]
|
A[/Christmas\]
|
||||||
A -->|Get money| B[\Go shopping/]
|
A -->|Get money| B[\Go shopping/]
|
||||||
B --> C{Let me thinksssss<br/>ssssssssssssssssssssss<br/>sssssssssssssssssssssssssss}
|
B --> C{Let me thinksssss<br/>ssssssssssssssssssssss<br/>sssssssssssssssssssssssssss}
|
||||||
C -->|One| D[Laptop]
|
C -->|One| D[/Laptop/]
|
||||||
C -->|Two| E[iPhone]
|
C -->|Two| E[\iPhone\]
|
||||||
C -->|Three| F[Car]
|
C -->|Three| F[Car]
|
||||||
</div>
|
</div>
|
||||||
<div class="mermaid">
|
<div class="mermaid">
|
||||||
|
|
|
@ -110,6 +110,12 @@ export const addVertices = function (vert, g, svgId) {
|
||||||
case 'odd':
|
case 'odd':
|
||||||
_shape = 'rect_left_inv_arrow'
|
_shape = 'rect_left_inv_arrow'
|
||||||
break
|
break
|
||||||
|
case 'lean_right':
|
||||||
|
_shape = 'lean_right'
|
||||||
|
break
|
||||||
|
case 'lean_left':
|
||||||
|
_shape = 'lean_left'
|
||||||
|
break
|
||||||
case 'trapezoid':
|
case 'trapezoid':
|
||||||
_shape = 'trapezoid'
|
_shape = 'trapezoid'
|
||||||
break
|
break
|
||||||
|
@ -344,6 +350,48 @@ export const draw = function (text, id) {
|
||||||
return shapeSvg
|
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
|
// Add custom shape for box with inverted arrow on left side
|
||||||
render.shapes().trapezoid = function (parent, bbox, node) {
|
render.shapes().trapezoid = function (parent, bbox, node) {
|
||||||
const w = bbox.width
|
const w = bbox.width
|
||||||
|
|
|
@ -280,6 +280,14 @@ vertex: alphaNum SQS text SQE
|
||||||
{$$ = $1;yy.addVertex($1,$3,'inv_trapezoid');}
|
{$$ = $1;yy.addVertex($1,$3,'inv_trapezoid');}
|
||||||
| alphaNum INVTRAPSTART text INVTRAPEND spaceList
|
| alphaNum INVTRAPSTART text INVTRAPEND spaceList
|
||||||
{$$ = $1;yy.addVertex($1,$3,'inv_trapezoid');}
|
{$$ = $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
|
/* | alphaNum SQS text TAGSTART
|
||||||
{$$ = $1;yy.addVertex($1,$3,'odd_right');}
|
{$$ = $1;yy.addVertex($1,$3,'odd_right');}
|
||||||
| alphaNum SQS text TAGSTART spaceList
|
| alphaNum SQS text TAGSTART spaceList
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue