mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-25 20:23:53 +00:00
Gradient: an aspect for a Live Paint group without faces is an error
A fill edit of a selected Live Paint group with edges and no faces edits no object, yet paint.editGradient accepted an aspect there and returned no ids, and the Aspect Ratio field stayed enabled. - paint.editGradient refuses an aspect when the Live Paint filter leaves no object. Graph design art alone still changes nothing without an error, as for the other params. - Session::gradient_edit_has_objects reads the same filtered targets, so the field is dimmed in that case. - Params text and docs/mcp.md name the case.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -3332,7 +3332,7 @@ fn live_paint_bucket_paint_and_stroke_commands_leave_the_selection_unpainted() {
|
||||
}
|
||||
|
||||
/// `paint.editGradient` with an `aspect` and no object to edit (the Live Paint Bucket's gradient,
|
||||
/// or nothing selected) is an error that leaves the default gradient as it was, since a gradient
|
||||
/// nothing selected, or a fill edit of a Live Paint group without faces) is an error that leaves the default gradient as it was, since a gradient
|
||||
/// fitted to each object has no aspect of its own. Named objects still take the aspect.
|
||||
#[test]
|
||||
fn edit_gradient_aspect_without_objects_is_an_error() {
|
||||
@@ -3376,6 +3376,16 @@ fn edit_gradient_aspect_without_objects_is_an_error() {
|
||||
s.execute("select.set", &json!({"ids": [empty.0]})).unwrap();
|
||||
assert!(!s.gradient_edit_has_objects(false), "an empty group");
|
||||
assert!(s.execute("paint.editGradient", &json!({"stroke": false, "aspect": 50})).is_err());
|
||||
// A fill edit of a Live Paint group with edges and no faces edits no object; a stroke edit edits its edges.
|
||||
let line = NodeId(s.execute("shape.line", &json!({"x1": 0, "y1": 0, "x2": 100, "y2": 0})).unwrap()["id"].as_u64().unwrap());
|
||||
let edges_only = NodeId(s.execute("livePaint.make", &json!({"ids": [line.0]})).unwrap()["id"].as_u64().unwrap());
|
||||
s.execute("select.set", &json!({"ids": [edges_only.0]})).unwrap();
|
||||
let (fill, group, steps) = (s.paint.fill.clone(), node(&s, edges_only), s.doc().unwrap().history.undo.len());
|
||||
assert!(!s.gradient_edit_has_objects(false), "a Live Paint group without faces");
|
||||
assert!(s.gradient_edit_has_objects(true), "its edges take a stroke edit");
|
||||
assert!(s.execute("paint.editGradient", &json!({"stroke": false, "aspect": 50})).is_err());
|
||||
assert_eq!((&s.paint.fill, node(&s, edges_only)), (&fill, group), "the default and the group stay");
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), steps, "no undo step");
|
||||
// A selected object takes it.
|
||||
s.execute("select.set", &json!({"ids": [rect.0]})).unwrap();
|
||||
assert!(s.gradient_edit_has_objects(false) && s.gradient_edit_has_objects(true));
|
||||
|
||||
+1
-1
@@ -1651,7 +1651,7 @@ for a conic gradient is an error. A negative `aspect` mirrors the sweep (counter
|
||||
does; for the other kinds a negative `aspect` is an error. The Gradient panel's Aspect Ratio field and the aspect dot
|
||||
keep a mirrored sweep mirrored. The default gradient for new art, and the Live Paint Bucket's, fits each object it
|
||||
paints and keeps no aspect, so `paint.editGradient` with an `aspect` is an error when it edits no object (nothing
|
||||
selected, or the bucket's gradient without `ids`) and leaves the default as it was. Dither and Method apply as they do to a linear gradient. PDF export writes it as a
|
||||
selected, the bucket's gradient without `ids`, or a fill edit of a Live Paint group without faces) and leaves the default as it was. Dither and Method apply as they do to a linear gradient. PDF export writes it as a
|
||||
function-based shading (type 1) whose calculator function turns the angle into the ramp, and PDF import reads a
|
||||
function-based shading whose color turns around the origin of its space back as a conic gradient, with its stops'
|
||||
opacity, also when the origin lies outside the painted area; in a PDF/A file, or with more than 97 stops on its
|
||||
|
||||
Reference in New Issue
Block a user