mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 14:59:53 +02:00
Cleanup unused variables and some commented out code
This commit is contained in:
@@ -85,9 +85,8 @@ function rightToLeft(mindmap) {
|
|||||||
/**
|
/**
|
||||||
* @param mindmap
|
* @param mindmap
|
||||||
* @param dir
|
* @param dir
|
||||||
* @param conf
|
|
||||||
*/
|
*/
|
||||||
function layout(mindmap, dir, conf) {
|
function layout(mindmap, dir) {
|
||||||
const bb = new BoundingBox(30, 60);
|
const bb = new BoundingBox(30, 60);
|
||||||
|
|
||||||
const layout = new Layout(bb);
|
const layout = new Layout(bb);
|
||||||
|
@@ -47,9 +47,9 @@ function wrap(text, width) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultBkg = function (elem, node, section, conf) {
|
const defaultBkg = function (elem, node, section) {
|
||||||
const rd = 5;
|
const rd = 5;
|
||||||
const r = elem
|
elem
|
||||||
.append('path')
|
.append('path')
|
||||||
.attr('id', 'node-' + node.id)
|
.attr('id', 'node-' + node.id)
|
||||||
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
||||||
@@ -68,25 +68,22 @@ const defaultBkg = function (elem, node, section, conf) {
|
|||||||
.attr('x2', node.width)
|
.attr('x2', node.width)
|
||||||
.attr('y2', node.height);
|
.attr('y2', node.height);
|
||||||
};
|
};
|
||||||
const rectBkg = function (elem, node, section, conf) {
|
const rectBkg = function (elem, node) {
|
||||||
const r = elem
|
elem
|
||||||
.append('rect')
|
.append('rect')
|
||||||
.attr('id', 'node-' + node.id)
|
.attr('id', 'node-' + node.id)
|
||||||
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
||||||
.attr('height', node.height)
|
.attr('height', node.height)
|
||||||
.attr('width', node.width);
|
.attr('width', node.width);
|
||||||
};
|
};
|
||||||
const cloudBkg = function (elem, node, section, conf) {
|
const cloudBkg = function (elem, node) {
|
||||||
const rd = 5;
|
|
||||||
const r = elem;
|
|
||||||
const w = node.width;
|
const w = node.width;
|
||||||
const h = node.height;
|
const h = node.height;
|
||||||
const r0 = 0.1 * w;
|
|
||||||
const r1 = 0.15 * w;
|
const r1 = 0.15 * w;
|
||||||
const r2 = 0.25 * w;
|
const r2 = 0.25 * w;
|
||||||
const r3 = 0.35 * w;
|
const r3 = 0.35 * w;
|
||||||
const r4 = 0.2 * w;
|
const r4 = 0.2 * w;
|
||||||
const p = elem
|
elem
|
||||||
.append('path')
|
.append('path')
|
||||||
.attr('id', 'node-' + node.id)
|
.attr('id', 'node-' + node.id)
|
||||||
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
||||||
@@ -109,12 +106,11 @@ const cloudBkg = function (elem, node, section, conf) {
|
|||||||
H0 V0 Z`
|
H0 V0 Z`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const bangBkg = function (elem, node, section, conf) {
|
const bangBkg = function (elem, node) {
|
||||||
const rd = 5;
|
|
||||||
const w = node.width;
|
const w = node.width;
|
||||||
const h = node.height;
|
const h = node.height;
|
||||||
const r = 0.15 * w;
|
const r = 0.15 * w;
|
||||||
const p = elem
|
elem
|
||||||
.append('path')
|
.append('path')
|
||||||
.attr('id', 'node-' + node.id)
|
.attr('id', 'node-' + node.id)
|
||||||
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
||||||
@@ -141,16 +137,15 @@ const bangBkg = function (elem, node, section, conf) {
|
|||||||
H0 V0 Z`
|
H0 V0 Z`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const circleBkg = function (elem, node, section, conf) {
|
const circleBkg = function (elem, node) {
|
||||||
const r = elem
|
elem
|
||||||
.append('circle')
|
.append('circle')
|
||||||
.attr('id', 'node-' + node.id)
|
.attr('id', 'node-' + node.id)
|
||||||
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
||||||
.attr('r', node.width / 2);
|
.attr('r', node.width / 2);
|
||||||
// .attr('width', node.width);
|
|
||||||
};
|
};
|
||||||
const roundedRectBkg = function (elem, node, section, conf) {
|
const roundedRectBkg = function (elem, node) {
|
||||||
const r = elem
|
elem
|
||||||
.append('rect')
|
.append('rect')
|
||||||
.attr('id', 'node-' + node.id)
|
.attr('id', 'node-' + node.id)
|
||||||
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
.attr('class', 'node-bkg node-' + db.type2Str(node.type))
|
||||||
@@ -183,7 +178,6 @@ export const drawNode = function (elem, node, section, conf) {
|
|||||||
.append('text')
|
.append('text')
|
||||||
.text(node.descr)
|
.text(node.descr)
|
||||||
.attr('dy', '1em')
|
.attr('dy', '1em')
|
||||||
// .attr('dy', '0')
|
|
||||||
.attr('alignment-baseline', 'middle')
|
.attr('alignment-baseline', 'middle')
|
||||||
.attr('dominant-baseline', 'middle')
|
.attr('dominant-baseline', 'middle')
|
||||||
.attr('text-anchor', 'middle')
|
.attr('text-anchor', 'middle')
|
||||||
@@ -195,18 +189,12 @@ export const drawNode = function (elem, node, section, conf) {
|
|||||||
if (node.icon) {
|
if (node.icon) {
|
||||||
if (node.type === db.nodeType.CIRCLE) {
|
if (node.type === db.nodeType.CIRCLE) {
|
||||||
node.height += 50;
|
node.height += 50;
|
||||||
const orgWidth = node.width;
|
|
||||||
node.width += 50;
|
node.width += 50;
|
||||||
// node.width = Math.max(orgWidth, 100);
|
|
||||||
const widthDiff = Math.abs(node.width - orgWidth);
|
|
||||||
const icon = nodeElem
|
const icon = nodeElem
|
||||||
.append('foreignObject')
|
.append('foreignObject')
|
||||||
.attr('height', '50px')
|
.attr('height', '50px')
|
||||||
.attr('width', node.width)
|
.attr('width', node.width)
|
||||||
.attr('style', 'text-align: center;');
|
.attr('style', 'text-align: center;');
|
||||||
// .attr('x', 0)
|
|
||||||
// .attr('y', 0)
|
|
||||||
// .attr('class', 'node-icon ' + node.icon);
|
|
||||||
icon
|
icon
|
||||||
.append('div')
|
.append('div')
|
||||||
.attr('class', 'icon-container')
|
.attr('class', 'icon-container')
|
||||||
@@ -226,9 +214,7 @@ export const drawNode = function (elem, node, section, conf) {
|
|||||||
.attr('width', '60px')
|
.attr('width', '60px')
|
||||||
.attr('height', node.height)
|
.attr('height', node.height)
|
||||||
.attr('style', 'text-align: center;margin-top:' + heightDiff / 2 + 'px;');
|
.attr('style', 'text-align: center;margin-top:' + heightDiff / 2 + 'px;');
|
||||||
// .attr('x', 0)
|
|
||||||
// .attr('y', 0)
|
|
||||||
// .attr('class', 'node-icon ' + node.icon);
|
|
||||||
icon
|
icon
|
||||||
.append('div')
|
.append('div')
|
||||||
.attr('class', 'icon-container')
|
.attr('class', 'icon-container')
|
||||||
@@ -258,15 +244,11 @@ export const drawNode = function (elem, node, section, conf) {
|
|||||||
circleBkg(bkgElem, node, section, conf);
|
circleBkg(bkgElem, node, section, conf);
|
||||||
break;
|
break;
|
||||||
case db.nodeType.CLOUD:
|
case db.nodeType.CLOUD:
|
||||||
// bkgElem.attr('transform', 'translate(' + node.width / 2 + ', ' + +node.height / 2 + ')');
|
|
||||||
cloudBkg(bkgElem, node, section, conf);
|
cloudBkg(bkgElem, node, section, conf);
|
||||||
break;
|
break;
|
||||||
case db.nodeType.BANG:
|
case db.nodeType.BANG:
|
||||||
// bkgElem.attr('transform', 'translate(' + node.width / 2 + ', ' + +node.height / 2 + ')');
|
|
||||||
bangBkg(bkgElem, node, section, conf);
|
bangBkg(bkgElem, node, section, conf);
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
// defaultBkg(bkgElem, node, section, conf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position the node to its coordinate
|
// Position the node to its coordinate
|
||||||
@@ -277,17 +259,7 @@ export const drawNode = function (elem, node, section, conf) {
|
|||||||
return node.height;
|
return node.height;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const drawEdge = function drawEdge(edgesElem, mindmap, parent, depth, section, conf) {
|
export const drawEdge = function drawEdge(edgesElem, mindmap, parent, depth, section) {
|
||||||
// edgesElem
|
|
||||||
// .append('line')
|
|
||||||
// .attr('x1', parent.x + parent.width / 2)
|
|
||||||
// .attr('y1', parent.y + parent.height / 2)
|
|
||||||
// .attr('x2', mindmap.x + mindmap.width / 2)
|
|
||||||
// .attr('y2', mindmap.y + mindmap.height / 2)
|
|
||||||
// .attr('class', 'edge section-edge-' + section + ' edge-depth-' + depth);
|
|
||||||
|
|
||||||
//<path d="M100,250 Q250,100 400,250 T700,250" />
|
|
||||||
|
|
||||||
const sx = parent.x + parent.width / 2;
|
const sx = parent.x + parent.width / 2;
|
||||||
const sy = parent.y + parent.height / 2;
|
const sy = parent.y + parent.height / 2;
|
||||||
const ex = mindmap.x + mindmap.width / 2;
|
const ex = mindmap.x + mindmap.width / 2;
|
||||||
@@ -308,7 +280,7 @@ export const drawEdge = function drawEdge(edgesElem, mindmap, parent, depth, sec
|
|||||||
.attr('class', 'edge section-edge-' + section + ' edge-depth-' + depth);
|
.attr('class', 'edge section-edge-' + section + ' edge-depth-' + depth);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const positionNode = function (node, conf) {
|
export const positionNode = function (node) {
|
||||||
const nodeElem = db.getElementById(node.id);
|
const nodeElem = db.getElementById(node.id);
|
||||||
|
|
||||||
const x = node.x || 0;
|
const x = node.x || 0;
|
||||||
|
@@ -43,7 +43,6 @@ const directiveWithoutOpen =
|
|||||||
/**
|
/**
|
||||||
* @function detectInit Detects the init config object from the text
|
* @function detectInit Detects the init config object from the text
|
||||||
* @param config
|
* @param config
|
||||||
* @param config
|
|
||||||
*
|
*
|
||||||
* ```mermaid
|
* ```mermaid
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user