Node / Lines Connectors · guide
path2d.custom — API & validation
Current Apexify.js 6.0.0 documentation for path2d.custom — API & validation.
Signature: await painter.path2d.custom(options, canvasBuffer)
options— oneCustomOptionsobject or an array processed in order (later segments paint above earlier ones unlesssingleLinechains geometry).canvasBuffer—BufferorCanvasResults(.buffer PNG bytes).
Implementation: runDrawCustomLines (apex-painter/path-custom-lines.ts) loads the buffer into a fresh canvas, runs customLines(ctx, opts), returns image/png Buffer.
Validation
Throws if:
| Condition | Message prefix |
|---|---|
Missing buffer | createCustom: buffer is required. |
Empty options array | createCustom: At least one custom option is required. |
startCoordinates.x/y not finite numbers | createCustom: startCoordinates with valid x and y are required. |
endCoordinates.x/y not finite numbers | createCustom: endCoordinates with valid x and y are required. |
CustomOptions shape (top level)
| Field | Required | Role |
|---|---|---|
startCoordinates | Yes | { x, y } segment start |
endCoordinates | Yes | { x, y } segment end |
path | No | Curve generator (smooth, catmull-rom, bezier) — see Line style & path |
arrow | No | start/end arrowheads |
markers | No | Samples along the polyline [start→end] |
lineStyle | No | Stroke appearance (defaults mimic thin black stroke) |
Full lineStyle / arrow / markers tables live in the next chapters.
Batch drawing
Pass CustomOptions[] to paint multiple independent connectors (flowcharts, timelines). Order matters for overlaps — draw guides before foreground strokes.
Chained segments (lineStyle.singleLine)
When singleLine: true, customLines keeps beginPath open across consecutive rows:
- Row
i > 0reusespreviousEndCoordinatesas the effectivemoveToanchor (start vertex omitted fromlineTochain except on the first row of the sequence). - Stroke executes when
singleLineends or on the last row of the batch.
Use this for one continuous stroke through several endCoordinates knots while varying arrow/markers only on relevant rows.
Scene parity
SceneLayer { type: 'customLines', lines: CustomOptions | CustomOptions[] } uses the same validation (scene-normalizer) before customLines runs.