Skip to content

@fabwcie/free-drawing / utils/elbow

utils/elbow ​

Variables ​

elbowMargin ​

const elbowMargin: 24 = 24

Defined in: packages/free-drawing/src/utils/elbow.ts:8

Least distance an elbow arrow goes straight out of a linked shape before turning, and keeps from its shapes (less between close shapes)

Functions ​

getElbowPoints() ​

getElbowPoints(start, end, boxes?, offset?, distance?): Vector2d[]

Defined in: packages/free-drawing/src/utils/elbow.ts:349

Points of an elbow arrow between its ends (see routeElbow), its middle segment moved by its elbowMid attribute

Parameters

start

Vector2d

Start of the arrow

end

Vector2d

End of the arrow

boxes?

EndBoxes = ...

Boxes of the shapes linked to the start and the end, in the same coordinates

offset?

number

Position of the middle segment from the middle between the ends (elbowMid), undefined: automatic

distance?

number = elbowMargin

Distance kept from the shapes: room for the head of the arrow straight out of a shape

Returns

Vector2d[]

Points of the path, from start to end


getMiddleSegment() ​

getMiddleSegment(points): ElbowSegment | null

Defined in: packages/free-drawing/src/utils/elbow.ts:331

Middle segment of an elbow path, between two turns (not at an end): moved by the handle of the arrow

Parameters

points

Vector2d[]

Points of the path

Returns

ElbowSegment | null

Middle one of the inner segments, null without (a straight line or one corner)


isOnLine() ​

isOnLine(points, axis, value): boolean

Defined in: packages/free-drawing/src/utils/elbow.ts:376

A turn of an elbow path is on a line

Parameters

points

Vector2d[]

Points of the path

axis

"x" | "y"

x for a vertical line, y for a horizontal one

value

number

Coordinate of the line

Returns

boolean

True when a point between the ends is on the line