mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
The Simplify help page says a path can be simplified whole or "a specific path region with the Direct Selection tool" (https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/manually-simplify-paths.html). Simplify refitted every selected path whole, whatever part of it was direct-selected. object.path.simplify now looks at each path's direct selection: the segments picked as segments, or else every segment with both anchors selected. Each run of consecutive selected segments is refitted on its own (vectorcraft_pathops::simplify_part) between its two end anchors, which stay where they are with their handles on the side away from the run; every other anchor and segment stays exactly as it was. A closed path's run may cross its start point (the path then starts at the run's end anchor), separate runs on one path simplify independently in one undo step, and the runs stay direct-selected (as segments when segments were picked). A path with only lone anchors selected still simplifies whole, as before, and wholePaths: true simplifies partly selected paths whole. The slider, its preview, Auto-Simplify and the Simplify dialog all run the command, so they act on the part too. simplify_with now shares its run fitting with the part refit (same results). Verification: crates/engine/src/tests_simplify_part.rs (unselected anchors and segments equal bit for bit, run end anchors fixed, the run within the tolerance, two runs equal to each simplified alone in one undo step, a closed run across the start point, picked segments, wholePaths, slider preview and Auto-Simplify, a run that can't be simpler records no step) and simplify_slider_and_dialog_simplify_only_the_direct_selected_part_of_a_path (the slider's preview, Enter and the dialog's OK). Live: the release build's slider at level 20 on a 91-anchor wave with anchors 30–60 selected refits only that stretch.