d3-graph-controller
Version:
A TypeScript library for visualizing and simulating directed, interactive graphs.
43 lines (42 loc) • 1.19 kB
text/typescript
import { GraphConfig } from './config.mjs';
import { NodeTypeToken } from '../model/graph.mjs';
import { GraphLink } from '../model/link.mjs';
import { GraphNode } from '../model/node.mjs';
/**
* Marker configuration.
*/
export interface MarkerConfig {
/**
* Size of the marker's box.
*/
readonly size: number;
/**
* Get padding of the marker for calculating link paths.
* @param node - The node the marker is pointing at.
* @param config - The current config.
* @returns The padding of the marker.
*/
readonly padding: <T extends NodeTypeToken, Node extends GraphNode<T>, Link extends GraphLink<T, Node>>(node: Node, config: GraphConfig<T, Node, Link>) => number;
/**
* The ref of the marker.
*/
readonly ref: [number, number];
/**
* The path of the marker.
*/
readonly path: [number, number][];
/**
* The ViewBox of the marker.
*/
readonly viewBox: string;
}
/**
* Collection of built-in markers.
*/
export declare const Markers: {
/**
* Create an arrow marker configuration.
* @param size - The size of the arrow
*/
Arrow: (size: number) => MarkerConfig;
};