UNPKG

@plait/graph-viz

Version:

#### Dependence - `@plait/core`

43 lines (42 loc) 1.14 kB
export type ArrowOptions = { bow?: number; stretchMin?: number; stretchMax?: number; stretch?: number; padStart?: number; padEnd?: number; flip?: boolean; straights?: boolean; }; /** * getArrow * Get the points for a linking line between two points. * @description Draw an arrow between two points. * @param x0 The x position of the "from" point. * @param y0 The y position of the "from" point. * @param x1 The x position of the "to" point. * @param y1 The y position of the "to" point. * @param options Additional options for computing the line. * @returns [sx, sy, cx, cy, e1, e2, ae, as, ac] * @example * const arrow = getArrow(0, 0, 100, 200, { bow: 0 stretch: .5 stretchMin: 0 stretchMax: 420 padStart: 0 padEnd: 0 flip: false straights: true * }) * * const [ * startX, startY, * controlX, controlY, * endX, endY, * endAngle, * startAngle, * controlAngle * ] = arrow */ export default function getArrow(x0: number, y0: number, x1: number, y1: number, options?: ArrowOptions): number[];