Skip to content

Changelog

All notable changes to @draw/sketch. The format follows Keep a Changelog. New entries go under Unreleased.

  • Package scaffold.
  • Path and PathCommand, the plain path data every sketch function returns. An internal seeded generator backs the random choices and is not exported.
  • roughEdges and RoughEdgesOptions. Straight-edged outlines are drawn twice per edge with roughjs-style offsets, bow and overshoot, scaled by roughness. Roughness 0 returns the input segments exactly.
  • roughCurve, RoughCurveOptions and RoughCurve. Smooth outlines are resampled, jittered and drawn as two Catmull-Rom passes. A closed curve starts at a random offset and overlaps its start with a tail of one or two steps. base returns the jittered points a fill hatches.
  • passes option on RoughEdgesOptions and RoughCurveOptions. passes: 1 draws only the first pass, for dashed and dotted strokes.
  • inkOutline and InkOptions. Freehand samples become a closed outline polygon of variable width with round caps, after streamlining. Pressure is the samples’ own or simulated from speed. A single sample is a dot.
  • hachureFill, HachureOptions and solidFill. Hachure cuts the polygon with parallel scanlines at -49 degrees and draws each span twice with its ends fixed, so the lines stay inside the outline. Cross-hatch adds a second set at right angles. Solid returns the polygon as one closed path.
  • paintShape, DrawOp and Drawing. A shape becomes an ordered list of stroke and fill operations in frame-local units: fill first, then the outline. Dashed and dotted strokes carry a dash pattern and draw one pass. Freehand is one filled ink outline. Text paints nothing.
  • Arrowheads in paintShape. Each end paints its arrow, bar, triangle or dot head with Excalidraw’s sizes and angles, capped at half the arrow’s length. Heads stay solid on dashed arrows.
  • PathCommandKind and DrawOpKind, named values for comparing path command and draw op kinds (ADR 0006). Internal comparisons use the shapes package’s named values.
  • A straight arrow’s shaft is drawn as one rough line, not a resampled curve, so it no longer wobbles at roughness 1 and above.
  • A closed curve starts near its top and overlaps its start by a fraction of one step that ends slightly inside, as rough.js does. The old tail of one or two steps read as a hook on every ellipse.
  • A closed curve’s second pass starts at its own random place near the top and does not overlap, as in rough.js. Both passes used to share one seam, which read as a doubled hook at roughness 2 and above.
  • roughCurve resamples to at most 512 points per pass, so a huge ellipse or arc no longer hangs.
  • Freehand ink follows perfect-freehand 1.2.2 more closely: points inside the first pen size are dropped, streamlining moves 57.5 percent per step, and simulated pressure warms up over the first 10 steps with no extra floor rate. A fast mouse stroke no longer starts with a fat blob.
  • paintShape simulates pressure only when every sample’s pressure is 0.5, as a mouse reports. A pen held at a constant pressure now draws with that pressure.
  • roughCurve treats a negative roughness as 0, as its docs promise. It used to jitter by the negative amount.
  • Numeric literals in src are named constants, as the new no-magic-numbers lint rule requires. Behaviour is unchanged.
  • hachureFill caps each set at 10000 lines, widening the gap on huge polygons. It cuts each edge only against the scanlines it spans and no longer overflows the stack on huge polygons. Output for normal shapes is unchanged.