mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-02 15:16:49 +02:00
#5237 Fixes from comments
This commit is contained in:
@@ -9,7 +9,6 @@ function b64ToUtf8(str) {
|
|||||||
|
|
||||||
// Adds a rendered flag to window when rendering is done, so cypress can wait for it.
|
// Adds a rendered flag to window when rendering is done, so cypress can wait for it.
|
||||||
function markRendered() {
|
function markRendered() {
|
||||||
console.log('Done rendering');
|
|
||||||
if (window.Cypress) {
|
if (window.Cypress) {
|
||||||
window.rendered = true;
|
window.rendered = true;
|
||||||
}
|
}
|
||||||
|
@@ -8,13 +8,6 @@ import type { BlockDB } from './blockDB.js';
|
|||||||
import { layout } from './layout.js';
|
import { layout } from './layout.js';
|
||||||
import { calculateBlockSizes, insertBlocks, insertEdges } from './renderHelpers.js';
|
import { calculateBlockSizes, insertBlocks, insertEdges } from './renderHelpers.js';
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the all the styles from classDef statements in the graph definition.
|
|
||||||
*
|
|
||||||
* @param text - The text with the classes
|
|
||||||
* @param diagObj - The diagram object
|
|
||||||
* @returns ClassDef - The styles
|
|
||||||
*/
|
|
||||||
export const getClasses = function (text: any, diagObj: any) {
|
export const getClasses = function (text: any, diagObj: any) {
|
||||||
return diagObj.db.getClasses();
|
return diagObj.db.getClasses();
|
||||||
};
|
};
|
||||||
@@ -45,8 +38,6 @@ export const draw = async function (
|
|||||||
const markers = ['point', 'circle', 'cross'];
|
const markers = ['point', 'circle', 'cross'];
|
||||||
|
|
||||||
// Add the marker definitions to the svg as marker tags
|
// Add the marker definitions to the svg as marker tags
|
||||||
// insertMarkers(svg, markers, diagObj.type, diagObj.arrowMarkerAbsolute);
|
|
||||||
// insertMarkers(svg, markers, diagObj.type, true);
|
|
||||||
insertMarkers(svg, markers, diagObj.type, id);
|
insertMarkers(svg, markers, diagObj.type, id);
|
||||||
|
|
||||||
const bl = db.getBlocks();
|
const bl = db.getBlocks();
|
||||||
@@ -59,11 +50,7 @@ export const draw = async function (
|
|||||||
await insertBlocks(nodes, bl, db);
|
await insertBlocks(nodes, bl, db);
|
||||||
await insertEdges(nodes, edges, blArr, db, id);
|
await insertEdges(nodes, edges, blArr, db, id);
|
||||||
|
|
||||||
// log.debug('Here', bl);
|
|
||||||
|
|
||||||
// Establish svg dimensions and get width and height
|
// Establish svg dimensions and get width and height
|
||||||
//
|
|
||||||
// const bounds2 = nodes.node().getBoundingClientRect();
|
|
||||||
// Why, oh why ????
|
// Why, oh why ????
|
||||||
if (bounds) {
|
if (bounds) {
|
||||||
const bounds2 = bounds;
|
const bounds2 = bounds;
|
||||||
|
@@ -131,12 +131,6 @@ const getDir = (parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => {
|
|||||||
return dir;
|
return dir;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param nodes
|
|
||||||
* @param nodeData
|
|
||||||
* @param classes
|
|
||||||
*/
|
|
||||||
function insertOrUpdateNode(nodes, nodeData, classes) {
|
function insertOrUpdateNode(nodes, nodeData, classes) {
|
||||||
if (!nodeData.id || nodeData.id === '</join></fork>' || nodeData.id === '</choice>') {
|
if (!nodeData.id || nodeData.id === '</join></fork>' || nodeData.id === '</choice>') {
|
||||||
return;
|
return;
|
||||||
|
@@ -33,9 +33,6 @@ const rect = async (parent, node) => {
|
|||||||
// Create the label and insert it after the rect
|
// Create the label and insert it after the rect
|
||||||
const labelEl = shapeSvg.insert('g').attr('class', 'cluster-label ');
|
const labelEl = shapeSvg.insert('g').attr('class', 'cluster-label ');
|
||||||
|
|
||||||
// const text = label
|
|
||||||
// .node()
|
|
||||||
// .appendChild(createLabel(node.label, node.labelStyle, undefined, true));
|
|
||||||
const text = await createText(labelEl, node.label, {
|
const text = await createText(labelEl, node.label, {
|
||||||
style: node.labelStyle,
|
style: node.labelStyle,
|
||||||
useHtmlLabels,
|
useHtmlLabels,
|
||||||
@@ -53,10 +50,7 @@ const rect = async (parent, node) => {
|
|||||||
dv.attr('height', bbox.height);
|
dv.attr('height', bbox.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
const padding = 0 * node.padding;
|
const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width;
|
||||||
|
|
||||||
const width =
|
|
||||||
(node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width) + padding;
|
|
||||||
if (node.width <= bbox.width + node.padding) {
|
if (node.width <= bbox.width + node.padding) {
|
||||||
node.diff = (width - node.width) / 2 - node.padding;
|
node.diff = (width - node.width) / 2 - node.padding;
|
||||||
} else {
|
} else {
|
||||||
@@ -66,7 +60,6 @@ const rect = async (parent, node) => {
|
|||||||
const height = node.height;
|
const height = node.height;
|
||||||
const x = node.x - width / 2;
|
const x = node.x - width / 2;
|
||||||
const y = node.y - height / 2;
|
const y = node.y - height / 2;
|
||||||
// console.log('UIO diff 2', node.id, node.diff, 'totalWidth: ', width);
|
|
||||||
|
|
||||||
log.trace('Data ', node, JSON.stringify(node));
|
log.trace('Data ', node, JSON.stringify(node));
|
||||||
let rect;
|
let rect;
|
||||||
@@ -82,7 +75,6 @@ const rect = async (parent, node) => {
|
|||||||
seed: handdrawnSeed,
|
seed: handdrawnSeed,
|
||||||
});
|
});
|
||||||
const roughNode = rc.path(createRoundedRectPathD(x, y, width, height, 0), options);
|
const roughNode = rc.path(createRoundedRectPathD(x, y, width, height, 0), options);
|
||||||
// console.log('Rough node insert CXC', roughNode);
|
|
||||||
rect = shapeSvg.insert(() => {
|
rect = shapeSvg.insert(() => {
|
||||||
log.debug('Rough node insert CXC', roughNode);
|
log.debug('Rough node insert CXC', roughNode);
|
||||||
return roughNode;
|
return roughNode;
|
||||||
|
Reference in New Issue
Block a user