geometry#

Interfaces#

Bounds#

Defined in: layout/src/geometry.ts:202

An axis-aligned rectangle by its edges.

Properties#

bottom#

readonly bottom: number

Defined in: layout/src/geometry.ts:206

left#

readonly left: number

Defined in: layout/src/geometry.ts:203

top#

readonly top: number

Defined in: layout/src/geometry.ts:204


Circle#

Defined in: layout/src/geometry.ts:21

A circle at (cx, cy) of radius r.

Properties#

cx#

readonly cx: number

Defined in: layout/src/geometry.ts:22

cy#

readonly cy: number

Defined in: layout/src/geometry.ts:23

r#

readonly r: number

Defined in: layout/src/geometry.ts:24


LineGeometry#

Defined in: layout/src/geometry.ts:37

A line’s stroke from x1 to x2 at y, and the marks at its start and its end.

Properties#

end#

readonly end: readonly LineMark[]

Defined in: layout/src/geometry.ts:42

start#

readonly start: readonly LineMark[]

Defined in: layout/src/geometry.ts:41

x1#

readonly x1: number

Defined in: layout/src/geometry.ts:38

x2#

readonly x2: number

Defined in: layout/src/geometry.ts:39

y#

readonly y: number

Defined in: layout/src/geometry.ts:40

Type Aliases#

LineMark#

LineMark = object & Circle | { filled: boolean; points: readonly Point[]; shape: "polygon"; } | { points: readonly Point[]; shape: "polyline"; }

Defined in: layout/src/geometry.ts:31

One mark at an end of a line: its circle, its arrowhead or diamond (a polygon, filled or drawn in outline), or one of its chevrons.

Functions#

boundsOf()#

boundsOf(element, measure): Bounds

Defined in: layout/src/geometry.ts:267

The geometric bounds of an element (section 6.7): its outline, no stroke width counted; a brace or a jump by its points, controls included; a text by its advance width from its anchor and its ascent and descent.

Parameters#

element#

DrawnElement

measure#

TextMeasure

Returns#

Bounds


brace()#

brace(__namedParameters): PathCommand[]

Defined in: layout/src/geometry.ts:132

The brace of a region from x1 to x2, arms at yb, tip at (xm, ya) (section 7.2), as the path commands it is written with. Each of its two straight parts at ym, from x1 + k to xm − k and from xm + k to x2 − k, is cut where the gaps it spans meet it (section 6.6, Elisions; straightPart); its arms and tip are drawn whole.

Parameters#

__namedParameters#

RegionElement

Returns#

PathCommand[]


largestRightEdge()#

largestRightEdge(elements, measure): number | undefined

Defined in: layout/src/geometry.ts:388

The largest right edge of some elements, or undefined when none has one.

Parameters#

elements#

readonly DrawnElement[]

measure#

TextMeasure

Returns#

number | undefined


lineGeometry()#

lineGeometry(element): LineGeometry

Defined in: layout/src/geometry.ts:54

The geometry of a line (sections 6.6, 7.2 and 8.3): its stroke to where it stops (short of a diamond), its start circle or two left chevrons, and its end mark: the arrowhead, 3w long and 3w wide; the circle; the diamond, 1.2w high; three chevrons where its length is not known, two where it runs on; no mark at an end that lies in a gap (section 6.6, Elisions). A chevron’s arms lie w, 2.5w and 4w from the end, each tip 1.5w further, the inner one first.

Parameters#

element#

LineElement

Returns#

LineGeometry


rightEdge()#

rightEdge(element, measure): number | undefined

Defined in: layout/src/geometry.ts:375

The right edge of an element’s content (section 6.7): its bounds’ right, none for the block, a frame or a card, which hold content and are none.

Parameters#

element#

DrawnElement

measure#

TextMeasure

Returns#

number | undefined


wedgePoints()#

wedgePoints(__namedParameters): readonly [Point, Point, Point]

Defined in: layout/src/geometry.ts:225

A wedge’s three points (sections 6.6 and 7.2): its tip (X, yt), then the corners of its base (X + dx, y) in their order.

Parameters#

__namedParameters#

Pick<MarkerElement, "x" | "yt" | "corners">

Returns#

readonly [Point, Point, Point]