mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 23:09:49 +02:00
add shape datastore
(for nodes of data flow diagram)
See https://github.com/mermaid-js/mermaid/issues/1893
This commit is contained in:
@@ -176,6 +176,24 @@ function subroutine(parent, bbox, node) {
|
|||||||
return shapeSvg;
|
return shapeSvg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function datastore(parent, bbox, node) {
|
||||||
|
const shapeSvg = parent
|
||||||
|
.insert('rect', ':first-child')
|
||||||
|
.attr('class', 'basic label-container')
|
||||||
|
.attr('style', node.style)
|
||||||
|
.attr('rx', node.rx)
|
||||||
|
.attr('ry', node.ry)
|
||||||
|
.attr('x', -bbox.width / 2)
|
||||||
|
.attr('y', -bbox.height / 2)
|
||||||
|
.attr('width', bbox.width)
|
||||||
|
.attr('height', bbox.height)
|
||||||
|
.attr('stroke-dasharray', bbox.width + ' ' + bbox.height);
|
||||||
|
node.intersect = function (point) {
|
||||||
|
return dagreD3.intersect.rect(node, point);
|
||||||
|
};
|
||||||
|
return shapeSvg;
|
||||||
|
}
|
||||||
|
|
||||||
function cylinder(parent, bbox, node) {
|
function cylinder(parent, bbox, node) {
|
||||||
const w = bbox.width;
|
const w = bbox.width;
|
||||||
const rx = w / 2;
|
const rx = w / 2;
|
||||||
@@ -244,6 +262,7 @@ export function addToRender(render) {
|
|||||||
render.shapes().hexagon = hexagon;
|
render.shapes().hexagon = hexagon;
|
||||||
render.shapes().stadium = stadium;
|
render.shapes().stadium = stadium;
|
||||||
render.shapes().subroutine = subroutine;
|
render.shapes().subroutine = subroutine;
|
||||||
|
render.shapes().datastore = datastore;
|
||||||
render.shapes().cylinder = cylinder;
|
render.shapes().cylinder = cylinder;
|
||||||
|
|
||||||
// Add custom shape for box with inverted arrow on left side
|
// Add custom shape for box with inverted arrow on left side
|
||||||
@@ -270,6 +289,7 @@ export function addToRenderV2(addShape) {
|
|||||||
addShape({ hexagon });
|
addShape({ hexagon });
|
||||||
addShape({ stadium });
|
addShape({ stadium });
|
||||||
addShape({ subroutine });
|
addShape({ subroutine });
|
||||||
|
addShape({ datastore });
|
||||||
addShape({ cylinder });
|
addShape({ cylinder });
|
||||||
|
|
||||||
// Add custom shape for box with inverted arrow on left side
|
// Add custom shape for box with inverted arrow on left side
|
||||||
|
@@ -123,6 +123,9 @@ export const addVertices = function (vert, g, svgId) {
|
|||||||
case 'subroutine':
|
case 'subroutine':
|
||||||
_shape = 'subroutine';
|
_shape = 'subroutine';
|
||||||
break;
|
break;
|
||||||
|
case 'datastore':
|
||||||
|
_shape = 'datastore';
|
||||||
|
break;
|
||||||
case 'cylinder':
|
case 'cylinder':
|
||||||
_shape = 'cylinder';
|
_shape = 'cylinder';
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user