diff --git a/packages/mermaid/src/rendering-util/rendering-elements/edges.js b/packages/mermaid/src/rendering-util/rendering-elements/edges.js index c6fa43f72..d22297694 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/edges.js +++ b/packages/mermaid/src/rendering-util/rendering-elements/edges.js @@ -1,25 +1,14 @@ -import { log } from '$root/logger.js'; -import createLabel from './createLabel.js'; -import { createText } from '$root/rendering-util/createText.ts'; -import { - line, - curveBasis, - curveLinear, - curveNatural, - curveCardinal, - curveStep, - select, - curveMonotoneX, - curveMonotoneY, - curveCatmullRom, -} from 'd3'; import { getConfig } from '$root/diagram-api/diagramAPI.js'; -import utils from '$root/utils.js'; import { evaluate } from '$root/diagrams/common/common.js'; +import { log } from '$root/logger.js'; +import { createText } from '$root/rendering-util/createText.ts'; +import utils from '$root/utils.js'; import { getLineFunctionsWithOffset } from '$root/utils/lineWithOffset.js'; import { getSubGraphTitleMargins } from '$root/utils/subGraphTitleMargins.js'; -import { addEdgeMarkers } from './edgeMarker.ts'; +import { curveBasis, line, select } from 'd3'; import rough from 'roughjs'; +import createLabel from './createLabel.js'; +import { addEdgeMarkers } from './edgeMarker.ts'; //import type { Edge } from '$root/rendering-util/types.d.ts'; let edgeLabels = {}; @@ -339,23 +328,23 @@ export const intersection = (node, outsidePoint, insidePoint) => { * and return an update path ending by the border of the node. * * @param {Array} _points - * @param {any} boundryNode + * @param {any} boundaryNode * @returns {Array} Points */ -const cutPathAtIntersect = (_points, boundryNode) => { - log.warn('abc88 cutPathAtIntersect', _points, boundryNode); +const cutPathAtIntersect = (_points, boundaryNode) => { + log.warn('abc88 cutPathAtIntersect', _points, boundaryNode); let points = []; let lastPointOutside = _points[0]; let isInside = false; _points.forEach((point) => { // const node = clusterDb[edge.toCluster].node; - log.info('abc88 checking point', point, boundryNode); + log.info('abc88 checking point', point, boundaryNode); // check if point is inside the boundary rect - if (!outsideNode(boundryNode, point) && !isInside) { + if (!outsideNode(boundaryNode, point) && !isInside) { // First point inside the rect found // Calc the intersection coord between the point anf the last point outside the rect - const inter = intersection(boundryNode, lastPointOutside, point); + const inter = intersection(boundaryNode, lastPointOutside, point); log.warn('abc88 inside', point, lastPointOutside, inter); log.warn('abc88 intersection', inter); @@ -450,7 +439,7 @@ const findAdjacentPoint = function (pointA, pointB, distance) { }; /** - * Given an array of points, this function will return a new array of points where the cornershave been removed and replaced with + * Given an array of points, this function will return a new array of points where the corners have been removed and replaced with * adjacent points in each direction. SO a corder will be replaced with a point before and the point after the corner. */ diff --git a/packages/mermaid/src/rendering-util/rendering-elements/shapes/rect.ts b/packages/mermaid/src/rendering-util/rendering-elements/shapes/rect.ts index 78c4d53c2..0f4e3098c 100644 --- a/packages/mermaid/src/rendering-util/rendering-elements/shapes/rect.ts +++ b/packages/mermaid/src/rendering-util/rendering-elements/shapes/rect.ts @@ -7,56 +7,49 @@ import { getConfig } from '$root/diagram-api/diagramAPI.js'; import { userNodeOverrides } from '$root/rendering-util/rendering-elements/shapes/handdrawnStyles.js'; import rough from 'roughjs'; -/** - * - * @param rect - * @param borders - * @param totalWidth - * @param totalHeight - */ -function applyNodePropertyBorders( - rect: d3.Selection, - borders: string | undefined, - totalWidth: number, - totalHeight: number -) { - if (!borders) { - return; - } - const strokeDashArray: number[] = []; - const addBorder = (length: number) => { - strokeDashArray.push(length, 0); - }; - const skipBorder = (length: number) => { - strokeDashArray.push(0, length); - }; - if (borders.includes('t')) { - log.debug('add top border'); - addBorder(totalWidth); - } else { - skipBorder(totalWidth); - } - if (borders.includes('r')) { - log.debug('add right border'); - addBorder(totalHeight); - } else { - skipBorder(totalHeight); - } - if (borders.includes('b')) { - log.debug('add bottom border'); - addBorder(totalWidth); - } else { - skipBorder(totalWidth); - } - if (borders.includes('l')) { - log.debug('add left border'); - addBorder(totalHeight); - } else { - skipBorder(totalHeight); - } +// function applyNodePropertyBorders( +// rect: d3.Selection, +// borders: string | undefined, +// totalWidth: number, +// totalHeight: number +// ) { +// if (!borders) { +// return; +// } +// const strokeDashArray: number[] = []; +// const addBorder = (length: number) => { +// strokeDashArray.push(length, 0); +// }; +// const skipBorder = (length: number) => { +// strokeDashArray.push(0, length); +// }; +// if (borders.includes('t')) { +// log.debug('add top border'); +// addBorder(totalWidth); +// } else { +// skipBorder(totalWidth); +// } +// if (borders.includes('r')) { +// log.debug('add right border'); +// addBorder(totalHeight); +// } else { +// skipBorder(totalHeight); +// } +// if (borders.includes('b')) { +// log.debug('add bottom border'); +// addBorder(totalWidth); +// } else { +// skipBorder(totalWidth); +// } +// if (borders.includes('l')) { +// log.debug('add left border'); +// addBorder(totalHeight); +// } else { +// skipBorder(totalHeight); +// } - rect.attr('stroke-dasharray', strokeDashArray.join(' ')); -} +// rect.attr('stroke-dasharray', strokeDashArray.join(' ')); +// } export const rect = async (parent: SVGAElement, node: Node) => { const { themeVariables, handdrawnSeed } = getConfig();