chore: cleanup unused parameters , reuse existing types

on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
darshanr0107
2025-08-22 19:09:38 +05:30
parent d35f84f337
commit bd400a5130
2 changed files with 5 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
import type { LayoutData, MermaidConfig } from 'mermaid'; import type { LayoutData } from 'mermaid';
import type { Bounds, Point } from 'mermaid/src/types.js'; import type { Bounds, Point } from 'mermaid/src/types.js';
import { BoundingBox, Layout } from 'non-layered-tidy-tree-layout'; import { BoundingBox, Layout } from 'non-layered-tidy-tree-layout';
import type { import type {
@@ -20,10 +20,7 @@ import type {
* @param config - Mermaid configuration object * @param config - Mermaid configuration object
* @returns Promise resolving to layout result with positioned nodes and edges * @returns Promise resolving to layout result with positioned nodes and edges
*/ */
export function executeTidyTreeLayout( export function executeTidyTreeLayout(data: LayoutData): Promise<LayoutResult> {
data: LayoutData,
_config: MermaidConfig
): Promise<LayoutResult> {
let intersectionShift = 50; let intersectionShift = 50;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@@ -369,11 +366,7 @@ function positionRightTreeBidirectional(
* @param lineEnd - Ending point of the line * @param lineEnd - Ending point of the line
* @returns The intersection point * @returns The intersection point
*/ */
function computeCircleEdgeIntersection( function computeCircleEdgeIntersection(circle: Bounds, lineStart: Point, lineEnd: Point): Point {
circle: Bounds,
lineStart: Point,
lineEnd: Point
): { x: number; y: number } {
const radius = Math.min(circle.width, circle.height) / 2; const radius = Math.min(circle.width, circle.height) / 2;
const dx = lineEnd.x - lineStart.x; const dx = lineEnd.x - lineStart.x;
@@ -393,11 +386,7 @@ function computeCircleEdgeIntersection(
}; };
} }
function intersection( function intersection(node: PositionedNode, outsidePoint: Point, insidePoint: Point): Point {
node: { x: number; y: number; width?: number; height?: number },
outsidePoint: { x: number; y: number },
insidePoint: { x: number; y: number }
): { x: number; y: number } {
const x = node.x; const x = node.x;
const y = node.y; const y = node.y;

View File

@@ -102,7 +102,7 @@ export const render = async (
}), }),
}; };
const layoutResult = await executeTidyTreeLayout(updatedLayoutData, data4Layout.config); const layoutResult = await executeTidyTreeLayout(updatedLayoutData);
// Step 3: Position the nodes based on bidirectional layout results // Step 3: Position the nodes based on bidirectional layout results
log.debug('Positioning nodes based on bidirectional layout results'); log.debug('Positioning nodes based on bidirectional layout results');