From 729080f4b12be139d8418baaa6027407fb9dd88f Mon Sep 17 00:00:00 2001 From: Knut Sveidqvist Date: Fri, 9 Aug 2024 14:04:53 +0200 Subject: [PATCH] #5237 Fixes from comments --- cypress/platform/viewer.js | 1 - .../mermaid/src/diagrams/block/blockRenderer.ts | 13 ------------- packages/mermaid/src/diagrams/state/dataFetcher.js | 6 ------ .../rendering-util/rendering-elements/clusters.js | 10 +--------- 4 files changed, 1 insertion(+), 29 deletions(-) diff --git a/cypress/platform/viewer.js b/cypress/platform/viewer.js index beb7015a50..0b480b8bc3 100644 --- a/cypress/platform/viewer.js +++ b/cypress/platform/viewer.js @@ -9,7 +9,6 @@ function b64ToUtf8(str) { // Adds a rendered flag to window when rendering is done, so cypress can wait for it. function markRendered() { - console.log('Done rendering'); if (window.Cypress) { window.rendered = true; } diff --git a/packages/mermaid/src/diagrams/block/blockRenderer.ts b/packages/mermaid/src/diagrams/block/blockRenderer.ts index 99b89ceeb2..509b5b7150 100644 --- a/packages/mermaid/src/diagrams/block/blockRenderer.ts +++ b/packages/mermaid/src/diagrams/block/blockRenderer.ts @@ -8,13 +8,6 @@ import type { BlockDB } from './blockDB.js'; import { layout } from './layout.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) { return diagObj.db.getClasses(); }; @@ -45,8 +38,6 @@ export const draw = async function ( const markers = ['point', 'circle', 'cross']; // 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); const bl = db.getBlocks(); @@ -59,11 +50,7 @@ export const draw = async function ( await insertBlocks(nodes, bl, db); await insertEdges(nodes, edges, blArr, db, id); - // log.debug('Here', bl); - // Establish svg dimensions and get width and height - // - // const bounds2 = nodes.node().getBoundingClientRect(); // Why, oh why ???? if (bounds) { const bounds2 = bounds; diff --git a/packages/mermaid/src/diagrams/state/dataFetcher.js b/packages/mermaid/src/diagrams/state/dataFetcher.js index 35c1d933f7..35cde69ab2 100644 --- a/packages/mermaid/src/diagrams/state/dataFetcher.js +++ b/packages/mermaid/src/diagrams/state/dataFetcher.js @@ -131,12 +131,6 @@ const getDir = (parsedItem, defaultDir = DEFAULT_NESTED_DOC_DIR) => { return dir; }; -/** - * - * @param nodes - * @param nodeData - * @param classes - */ function insertOrUpdateNode(nodes, nodeData, classes) { if (!nodeData.id || nodeData.id === '' || nodeData.id === '') { return; diff --git a/packages/mermaid/src/rendering-util/rendering-elements/clusters.js b/packages/mermaid/src/rendering-util/rendering-elements/clusters.js index d7bcf8727c..143d5e0b1f 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/clusters.js +++ b/packages/mermaid/src/rendering-util/rendering-elements/clusters.js @@ -33,9 +33,6 @@ const rect = async (parent, node) => { // Create the label and insert it after the rect 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, { style: node.labelStyle, useHtmlLabels, @@ -53,10 +50,7 @@ const rect = async (parent, node) => { dv.attr('height', bbox.height); } - const padding = 0 * node.padding; - - const width = - (node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width) + padding; + const width = node.width <= bbox.width + node.padding ? bbox.width + node.padding : node.width; if (node.width <= bbox.width + node.padding) { node.diff = (width - node.width) / 2 - node.padding; } else { @@ -66,7 +60,6 @@ const rect = async (parent, node) => { const height = node.height; const x = node.x - width / 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)); let rect; @@ -82,7 +75,6 @@ const rect = async (parent, node) => { seed: handdrawnSeed, }); const roughNode = rc.path(createRoundedRectPathD(x, y, width, height, 0), options); - // console.log('Rough node insert CXC', roughNode); rect = shapeSvg.insert(() => { log.debug('Rough node insert CXC', roughNode); return roughNode;