mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
Add a "Cyclic" gradient option that closes the ramp into a seamless loop (#4416)
* Add a Cyclic gradient attribute that wraps the stop list through the 1|0 boundary back to the first stop * Show the wrap segment's midpoint diamond in the color picker spectrum strip when cyclic * Keep the wrap midpoint diamond tracking the pointer by a wrapped strip width when dragged past the ends * Give the Gradient tool's viewport overlay the same cyclic wrap midpoint diamond and drag behavior * Correct the docs claiming the final stop's midpoint is always ignored now that cyclic uses it * Move the gradient cyclic toggle onto the Ends row as a Link icon checkbox * Update labels * Register GradientHueDirection with the Data panel so its attribute column renders * Reword wrap segment to wrapped interval and stray segment usages to interval * Clean up comments * Fix the color picker write-back losing default position elision and the blend path guessing the cyclic flag
This commit is contained in:
@@ -1086,7 +1086,7 @@ mod gradient_shape_migration {
|
||||
assert_eq!(ramp.gradient_space, GradientSpace::RgbGamma, "the pre-ramp flat form should carry the era's gamma");
|
||||
|
||||
let gradient = Gradient::from(ramp);
|
||||
assert_eq!(gradient.positions(), vec![0., 0.25]);
|
||||
assert_eq!(gradient.positions(false), vec![0., 0.25]);
|
||||
assert!(gradient.has_midpoint_attribute(), "the flat form must parse faithfully");
|
||||
}
|
||||
|
||||
@@ -1100,7 +1100,7 @@ mod gradient_shape_migration {
|
||||
assert_eq!(ramp.gradient_space, GradientSpace::RgbGamma, "the pre-ramp tuple form should carry the era's gamma");
|
||||
|
||||
let gradient = Gradient::from(ramp);
|
||||
assert_eq!(gradient.positions(), vec![0., 1.]);
|
||||
assert_eq!(gradient.positions(false), vec![0., 1.]);
|
||||
assert!(!gradient.has_position_attribute(), "even legacy tuple positions should elide");
|
||||
}
|
||||
|
||||
@@ -1122,6 +1122,10 @@ mod gradient_shape_migration {
|
||||
let TaggedValue::LegacyGradient(legacy) = load(json) else {
|
||||
panic!("the ancient full struct should become a legacy gradient value")
|
||||
};
|
||||
assert_eq!(Gradient::from(legacy.stops).positions(), vec![0., 1.], "the nested tuple stops should parse through the field adapter");
|
||||
assert_eq!(
|
||||
Gradient::from(legacy.stops).positions(false),
|
||||
vec![0., 1.],
|
||||
"the nested tuple stops should parse through the field adapter"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user