Add PATH_SPLIT mode to the Eraser Tool
What this does
This MR adds a new eraser mode called PATH_SPLIT, accessible via the eraser tool's mode selector in the toolbar. It is modeled on the path eraser tool from Macromedia Freehand, which many technical illustrators relied on heavily.
Unlike the existing CUT mode (which performs boolean difference operations on filled shapes), PATH_SPLIT works directly with lib2geom path intersections to split open or closed paths at the eraser stroke boundary, preserving both sides of the split as a single SVG path element with multiple subpaths.
Why it's useful
For technical illustration work (patent drawings, engineering diagrams, etc.), the dominant workflow involves open stroked paths rather than filled shapes. The existing CUT mode doesn't serve this use case well. PATH_SPLIT makes it possible to precisely trim and split paths the way a drafter would — draw across a line to cut it, with both pieces surviving.
How it works
- The eraser stroke is captured as a PathVector via the existing DynamicBase engine
- Intersection PathTimes between the eraser stroke and each target path are computed via lib2geom's
intersect() - The target path is split at those intersection points
- Each resulting segment is tested with a winding number check to determine if it falls inside the eraser shape
- Segments inside the eraser are discarded; segments outside are preserved
- The surviving segments are written back to the original SVG path element
- If all segments are erased, the element is deleted
- Selection is preserved after the erase stroke, so multiple distinct erases can be made on the same selection without reselecting
Files changed
src/ui/tools/eraser-tool.cpp— core implementationsrc/ui/tools/eraser-tool.h— declarationsshare/ui/toolbar-eraser.ui— toolbar mode selector updated to include PATH_SPLIT
Known limitations / future work
- Non-path shapes (rectangles, ellipses) must be converted to paths first (Object to Path, Ctrl+Shift+C) before PATH_SPLIT can operate on them. Auto-conversion is a planned improvement.
- Brush preview / cursor feedback is inherited from the existing eraser tool behavior and could be improved with a real-time circular preview.
Notes on development
This feature was developed by Aaron Johnson, a professional patent illustrator who uses Inkscape daily. Claude LLM generated the code from prompts. Aaron has a programming background but C++ and the Inkscape codebase are outside his usual expertise. He is happy to answer questions and work through any requested changes.






















