Documentation / @ripl/core / normalizePolylineRuns
Function: normalizePolylineRuns() ​
normalizePolylineRuns(
pointCount,segments?):PolylineSegment[]
Defined in: packages/core/src/elements/polyline.ts:90
Normalizes a polyline's segments into the contiguous, non-overlapping runs it is stroked in.
Segments are clamped to the point range and stamped in order (a later segment wins where two overlap), then adjacent runs resolving to the same dash are coalesced so the path is never split where its style does not actually change. Returns an empty array when the whole polyline resolves to its own dash pattern, so a uniformly styled line takes the single-stroke path.
Parameters ​
| Parameter | Type | Description |
|---|---|---|
pointCount | number | The number of points the polyline is drawn through. |
segments? | PolylineSegment[] | The spans to normalize. |
Returns ​
Contiguous runs covering every point exactly once, or an empty array when uniform.