mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-29 04:09:43 +02:00
3358 Adding types for blockArrowHelper
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
const expandAndDeduplicateDirections = (directions) => {
|
||||
import type { Direction } from '../../src/diagrams/block/blockTypes.js';
|
||||
|
||||
const expandAndDeduplicateDirections = (directions: Direction[]) => {
|
||||
const uniqueDirections = new Set();
|
||||
|
||||
for (const direction of directions) {
|
||||
@@ -19,7 +21,11 @@ const expandAndDeduplicateDirections = (directions) => {
|
||||
|
||||
return uniqueDirections;
|
||||
};
|
||||
export const getArrowPoints = (duplicatedDirections, bbox, node) => {
|
||||
export const getArrowPoints = (
|
||||
duplicatedDirections: Direction[],
|
||||
bbox: { width: number; height: number },
|
||||
node: any
|
||||
) => {
|
||||
// Expand and deduplicate the provided directions.
|
||||
// for instance: x, right => right, left
|
||||
const directions = expandAndDeduplicateDirections(duplicatedDirections);
|
||||
@@ -37,7 +43,7 @@ export const getArrowPoints = (duplicatedDirections, bbox, node) => {
|
||||
const padding = node.padding / 2;
|
||||
|
||||
// Initialize an empty array to store points for the arrow.
|
||||
let points = [];
|
||||
const points = [];
|
||||
|
||||
if (
|
||||
directions.has('right') &&
|
@@ -64,3 +64,5 @@ export interface ClassDef {
|
||||
textStyles: string[];
|
||||
styles: string[];
|
||||
}
|
||||
|
||||
export type Direction = 'up' | 'down' | 'left' | 'right' | 'x' | 'y';
|
||||
|
Reference in New Issue
Block a user