Files
Artstr-Studio/src/vendor
thePR0M3TH3AN eb9aec19d8 pathfinder: Unite / Subtract / Intersect / Exclude on shape selection
Boolean ops on 2+ selected shape layers, backed by the vendored
polygon-clipping library (29 KB minified, MIT) loaded from
src/vendor/. Adds a new "Pathfinder" details block in the sidebar
under Align & distribute.

- Unite combines all selected shapes into one outline.
- Subtract removes upper shapes from the bottom-most shape.
- Intersect keeps only the overlapping region.
- Exclude keeps only the non-overlapping regions (XOR).

Pipeline: each selected layer's pen path is sampled to a polygon
(16 samples per Bézier segment, in world inches), the chosen op
runs, and the result is rebuilt as a new pen layer that inherits
the bottom-most input layer's z-order, target, fill and stroke —
matching Illustrator's Pathfinder convention. Non-pen primitives
(rect, circle, etc.) are auto-converted to pen paths first.

Limitations baked in:
- Rotated layers aren't supported yet (we'd need to rotate the
  sampled polygon before clipping). The op refuses with a toast.
- Curves are flattened — the result is a polygon approximation
  with `fill-rule: evenodd` so multi-ring outputs (donut from a
  subtraction) render correctly. The renderer learned to honor
  shape.fillRule for this commit.
- Multi-polygon results stay rendered correctly but only the
  first polygon's outer ring is preserved in pen.nodes, so
  Direct Select editing post-op is partial.
2026-06-02 08:54:26 -04:00
..