mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
chore: Cleanup
This commit is contained in:
parent
de115e2071
commit
7167710800
@ -57,17 +57,6 @@ export const draw = async function (text: string, id: string, _version: string,
|
|||||||
// Create the root SVG - the element is the div containing the SVG element
|
// Create the root SVG - the element is the div containing the SVG element
|
||||||
const { element, svg } = getDiagramElements(id, securityLevel);
|
const { element, svg } = getDiagramElements(id, securityLevel);
|
||||||
|
|
||||||
// // For some diagrams this call is not needed, but in the state diagram it is
|
|
||||||
// await insertElementsForSize(element, data4Layout);
|
|
||||||
|
|
||||||
// console.log('data4Layout:', data4Layout);
|
|
||||||
|
|
||||||
// // Now we have layout data with real sizes, we can perform the layout
|
|
||||||
// const data4Rendering = doLayout(data4Layout, id, _version, 'dagre-wrapper');
|
|
||||||
|
|
||||||
// // The performRender method provided in all supported diagrams is used to render the data
|
|
||||||
// performRender(data4Rendering);
|
|
||||||
|
|
||||||
data4Layout.type = diag.type;
|
data4Layout.type = diag.type;
|
||||||
data4Layout.layoutAlgorithm = layout;
|
data4Layout.layoutAlgorithm = layout;
|
||||||
data4Layout.direction = DIR;
|
data4Layout.direction = DIR;
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
// import type { LayoutData } from './types';
|
|
||||||
import { select } from 'd3';
|
import { select } from 'd3';
|
||||||
import { insertNode } from '../dagre-wrapper/nodes.js';
|
|
||||||
|
|
||||||
// export const getDiagramElements = (id: string, securityLevel: any) => {
|
|
||||||
export const getDiagramElements = (id, securityLevel) => {
|
export const getDiagramElements = (id, securityLevel) => {
|
||||||
let sandboxElement;
|
let sandboxElement;
|
||||||
if (securityLevel === 'sandbox') {
|
if (securityLevel === 'sandbox') {
|
||||||
@ -21,44 +18,3 @@ export const getDiagramElements = (id, securityLevel) => {
|
|||||||
const element = root.select('#' + id + ' g');
|
const element = root.select('#' + id + ' g');
|
||||||
return { svg, element };
|
return { svg, element };
|
||||||
};
|
};
|
||||||
|
|
||||||
// export function insertElementsForSize(el: SVGElement, data: LayoutData): void {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param el
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
export function insertElementsForSize(el, data) {
|
|
||||||
const nodesElem = el.insert('g').attr('class', 'nodes');
|
|
||||||
el.insert('g').attr('class', 'edges');
|
|
||||||
data.nodes.forEach(async (item) => {
|
|
||||||
item.shape = 'rect';
|
|
||||||
await insertNode(nodesElem, {
|
|
||||||
...item,
|
|
||||||
class: 'default flowchart-label',
|
|
||||||
labelStyle: '',
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
width: 100,
|
|
||||||
rx: 0,
|
|
||||||
ry: 0,
|
|
||||||
height: 100,
|
|
||||||
shape: 'rect',
|
|
||||||
padding: 8,
|
|
||||||
});
|
|
||||||
// Create a new DOM element
|
|
||||||
// const element = document.createElement('div');
|
|
||||||
|
|
||||||
// // Set the content of the element to the name of the item
|
|
||||||
// element.textContent = item.name;
|
|
||||||
|
|
||||||
// // Set the size of the element to the size of the item
|
|
||||||
// element.style.width = `${item.size}px`;
|
|
||||||
// element.style.height = `${item.size}px`;
|
|
||||||
|
|
||||||
// Append the element to the body of the document
|
|
||||||
// document.body.appendChild(element);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default insertElementsForSize;
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user