mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 14:29:48 +02:00
chore: cleanup unused parameters , reuse existing types
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
|
@@ -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');
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user