Repository navigation
Conversation
Effect › SVG Filters and Apply SVG Filter list 14 default filters in every document, before the document's own. The set, the names and the values are VectorCraft's own, written with SVG 1.1 filter primitives (crates/effects/src/svg_filter/defaults.rs). A document holds none of the defaults until one is applied or edited there. svgFilter.apply with a default's name copies it into the document in the same undo step, and svgFilter.define with replace naming a default adds the edited copy under that name. The copy is listed in the default's place. svgFilter.delete refuses a default the document holds no copy of, and deleting the copy lists the default again. svgFilter.list also returns the defaults. svgFilter.apply takes index and item to put the filter in the place of an applied SVG filter, which the dialog's OK uses when it is opened for an applied effect; an index that is not an applied SVG filter, null included, is an error.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What and why
Effect › SVG Filters and Apply SVG Filter now list a set of default filters in every document. The help page describes picking a default filter from the
submenu, and editing a default's code in the dialog
(apply SVG filter effects).
Until now the lists held only the filters a document defined or imported.
SVG 1.1 filter primitives the effect already draws: Soft Blur, Heavy
Blur, Soft Shadow, Hard Shadow, Glow, Bevel, Emboss, Thicken, Thin, Rough Edges, Grain, Grayscale, Invert and Hue
Shift (
crates/effects/src/svg_filter/defaults.rs).svgFilter.applywith a default's name copies it into the document in the same undo step, and Save after Edit on a default adds the
edited copy under the default's name. The document's copy is then listed in the default's place.
svgFilter.deleterefuses it. Deleting the copylists the default again.
svgFilter.listalso returnsdefaults: [{name, xml, inDocument}].svgFilter.applytakesindex(anditem)to put the filter in the place of an applied SVG filter, which Apply SVG Filter's OK uses when it is opened from the
Appearance panel, so a default copied that way is still one undo step. An
indexthat is not an applied SVG filter,null included, is an error.
docs/mcp.md, the SVG Filters row ofdocs/effects-parity.mdand the evidence line indocs/target-app-parity.mdare updated.How it was tested
cargo fmt --all -- --check,cargo check --workspace --tests, andcargo clippy -p vectorcraft-effects -p vectorcraft-engine -p vectorcraft-ui-egui -p vectorcraft-mcp --all-targets -- -D warnings.cargo test -p vectorcraft-effects --lib svg_filter: 40 passed. The new tests check that every defaultpasses the filter check under its own name, draws, and is written to SVG as a filter; that Invert, Grayscale and Hue
Shift give the values SVG 1.1's formulas give; that Hard Shadow, Thicken and Thin move or resize the alpha by their
offset or radius; and the list order.
cargo test -p vectorcraft-engine --lib svgfilter: 35 passed. The new tests cover applying a default (one undostep, the copy added, undo removes it, and one history place taken when the history is full), editing and deleting
a default,
index, the 64-filter limit, and SVG export and the native format keeping an applied default.cargo test -p vectorcraft-engine --test command_sweep: 24 passed, with malformedindex,replaceanddeletecases added.
cargo test -p vectorcraft-ui-egui --lib: 4,646 passed, 2 ignored, including the dialog tests for the list order, OK on adefault, Edit and Save on a default, and the menu items.
cargo xtask brands,layers,assets,wasmandui-commands --check.Checklist
cargo xtask cipasses (fmt, clippy, tests, assets, brands, layers, wasm).unwrap(),expect(),panic!,unreachable!,todo!orunimplemented!outside tests, and no unchecked indexing on data from files, parameters ormessages. Errors are returned as
Resultand shown to the user(why and how).
ASSETS.md.Summary by CodeRabbit