mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-16 04:56:27 +00:00
Menus: Delete Empty Artboards and Save Gradient Preset decide their enabled state with less measuring
The enabled check of artboard.deleteEmpty built the full list of empty artboards, measuring the visual bounds of the art against every artboard, each time the Artboards panel menu was drawn. It now returns false at once in a document with one artboard (that artboard is never deleted). With two or more, it asks the new Document::any_artboard_without_art whether any unlocked artboard has no art, which is the same answer as a non-empty list. Document::any_artboard_without_art builds the symbol boxes once for all the artboards and first tests each path and compound path by a quick box: its control points' box grown by the farthest its strokes reach (Appearance::outset), with a margin for rounding. An artboard that no quick box meets is reported empty without measuring along any path. Only when every artboard may hold art is each one measured. Document::artboard_has_art also skips measuring an object whose quick box misses the artboard; its answers are unchanged. The check of gradient.presets.save found the proxy paints through Node::proxy_paint, which measures the object's geometric bounds for a gradient box the check does not use. Node::proxy_paint_only picks the same paint without measuring, and the engine's proxy_paint uses it, so the Fill and Stroke proxies and the mixed-paint test no longer measure each object either. With an open stroked path of 200,000 anchors selected, the two checks take under 0.01 ms instead of 21.9 ms and 17.2 ms in a release build, and Delete Empty Artboards' check takes 0.85 ms instead of 42.1 ms with a second, empty artboard. Tests compare each check with what its command does (one artboard, all empty, one empty, locked empty, nested art; with and without a gradient), compare any_empty_artboards with the previous check and with measuring every object on 120 seeded documents, compare the quick boxes with the visual bounds on seeded strokes, and compare proxy_paint_only with proxy_paint on seeded objects. Docs: docs/target-app-parity.md, one line under Delete Empty Artboards.
This commit is contained in:
@@ -519,6 +519,7 @@ since 2026-10-01.
|
||||
|
||||
- **Selected artboard deletion:** the Artboards panel menu, panel trash button and Properties use the same selected set; selecting all retains artboard 1. Pointer-event tests cover nonadjacent and single selections, the original first-board survivor, ordinary artwork, Undo/Redo and the single-board guard. Public reference: [Delete artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/delete-artboards.html).
|
||||
- **Delete Empty Artboards:** the Artboards panel menu item ([Delete artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/delete-artboards.html)) runs `artboard.deleteEmpty`: every unlocked artboard with no artwork goes with its guides in one undo step, artboard 1 stays when every artboard is empty and none is locked, and the panel makes an artboard that is left active; an artboard is empty when no object (hidden, locked and template art included; guides not) has visual bounds that meet or touch it, a group counting by its members and a clip group or clipping layer by its members inside the clip (our reading of "no artwork"; the pages give no finer rule). Engine tests in `tests/panelcmds.rs` (`delete_empty_artboards_*`) and the panel test `delete_empty_artboards_deletes_the_empty_ones_and_selects_one_left`.
|
||||
The menu item's enabled check measures nothing in a document with one artboard, and Save Gradient Preset's check reads the proxy's paint without measuring the object; both give the same answer as before. An artboard that no path's control points, grown by the farthest its strokes reach, can meet is found empty without measuring the path. With an open path of 200,000 anchors selected, the checks take under 0.01 ms instead of 21.9 ms and 17.2 ms in a release build; with a second, empty artboard, Delete Empty Artboards' check takes 0.85 ms instead of 42.1 ms. Tests `delete_empty_artboards_is_enabled_exactly_when_it_deletes_something`, `delete_empty_artboards_enabled_state_matches_the_command_on_varied_documents`, `empty_artboard_checks_match_the_visual_bounds_on_varied_strokes`, `the_empty_artboard_check_matches_measuring_every_artboard`, `the_save_check_matches_saving_with_and_without_a_gradient`, `the_unmeasured_proxy_paint_is_the_measured_one` and `the_unmeasured_proxy_paint_is_the_measured_one_on_varied_objects`.
|
||||
- **Artboard history selection:** headless pointer/key tests in `panels/properties.rs` pass for panel New → Undo → Delete/Backspace/Properties, Duplicate → Undo → Delete, pruning removed indices and preserving valid multiselection. They assert board survivors, artwork and object selection, Move/Scale Artwork options, saved state and Undo/Redo. Full workspace CI passes.
|
||||
- **Artboard tab-switch follow-up:** changing the active document through its tab aligns the Artboard tool with the displayed board before Properties Delete; clicking the already-active tab preserves multiselection and Move/Scale Artwork options. Three headless `chrome::tests::artboard_document_tab_*` regressions cover actual tab A → B → A clicks followed by Properties Delete, surviving boards and guides, preserved artwork/symbols and Undo/Redo; controls cover same-tab multiselection, Move/Scale Artwork options and other tools. Historical focused validation on `dbd2497b` recorded one expected RED failure with two passing controls, then all three GREEN tests passed. All three also passed in historical full CI on `a0671777`. A full CI retry on the five-unit combined source at `a0671777` passed all seven stages with 6,613 test outcomes on 2026-10-14. An earlier full-CI run on the identical source panicked in the randomized `ai_mutated_save_never_panics` test; the cause remains unresolved. This five-fix batch does not claim to repair that failure.
|
||||
- **Artboard clean active-tab close (2026-10-15):** with the Artboard tool active, closing a clean active tab restores the surviving document's displayed board before Properties Delete. Nine targeted checks passed: three existing tab regressions, one clean close/Delete regression and five existing unsaved-document controls. The close regression checks the correct surviving board, preserved artwork/symbols and object selection, affected guides, one Delete edit, saved state and Undo/Redo. Three reviewed original full-app headless captures show the active tab before closing, the surviving document's shown board after closing, and the correct survivor after Properties Delete, using the actual tab × and Delete controls.
|
||||
|
||||
Reference in New Issue
Block a user