mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
With the pointer resting over art while the view moves (trackpad or wheel scrolling, pinch zoom, a Hand/space pan), the document point under the pointer changes every frame, and the canvas hit-tested the art there on each one, up to three times: Object Highlighting (canvas.rs hover_highlight -> selection_hit_at) and the Selection tool's cursor (select.rs cursor: hit_test, and with Snap to Point the nearest-anchor search). Over a detailed engraving in a clip group (the reporter's PhotoCraft icon: one path of tens of thousands of segments) each of those costs roughly 3-6 ms, so every frame of the move took 12-15 ms of UI time; off the art they return at once. - canvas.rs: the canvas notes when its view (rect, zoom, centre, rotation) last changed. Until it has been still for HOVER_STILL_SECS (0.15 s) it draws no hover highlight and keeps the cursor the tool last gave for the same tool and modifier keys instead of asking again; it asks for a repaint then, so both come back without the pointer moving. Pointer moves still reach the tool as before. - test: a_moving_view_leaves_the_art_under_the_pointer_unhighlighted_until_it_stops (wheel frames draw no hover outline and keep the cursor; once still, the outline returns and the cursor follows the art). It fails on main at the first wheel frame. Measured on an Apple M4 (release build, 1440x900 window, the PhotoCraft app icon SVG fitted at 138%, Selection tool, Smart Guides and Snap to Point on), median UI frame time over 60 wheel-pan frames with the pointer resting: before: over the art 12.3-15.0 ms, off the art 1.0 ms after: over the art 0.4-1.0 ms, off the art 0.6 ms The render readout is the art's own raster time on the render worker, which this change doesn't touch.