mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-07 18:03:32 +00:00
Every click and hover measured each path and compound path along its curves to cull it (Node::reach_bounds_with), and a compound path was then assembled whole to test its outline and fill. For a compound path of thousands of members that took milliseconds per click. Hit testing now culls paths and compound paths by the box of their control points (which holds the curves), grown by their strokes' reach, so the box is never smaller than the reach box it replaces. A compound path's outline and fill are tested against only the members whose control box, grown by the tolerance, holds the point: a member outside that box is farther than the tolerance and winds zero times round the point. Painted strokes still follow the whole compound path (alignment, dashes, width profiles) and are measured along all of it, as before. Tests (crates/doc/src/hit/tests.rs): - a 2,000-member compound path hits exactly as the whole-path test did, at random points, on and next to anchors and on the edges of the members' boxes, for both fill rules, in Outline view and with Object Selection by Path Only; - wide strokes painting past the control points are still hit, for a path and a compound path; - the cull box holds the reach box for paths and compound paths. Measured in a debug test build (one run, machine not idle): a click on a 20,000-member compound path went from about 18 ms to about 1 ms. vectorcraft-cli perf was not rerun.