mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-04 13:02:50 -05:00
Gradient: comments in the stop popover code use American spelling
This commit is contained in:
1 parent
e4b486ebf2
commit
e8068cb1e0
2 files changed
+10
-10
No files matched your search
@@ -276,9 +276,9 @@ fn recolor(mut stops: Vec<GradientStop>, i: usize, color: Color, link: Option<(S
|
||||
stops
|
||||
}
|
||||
|
||||
/// Solid colours of the document's swatches (groups included), with their names, and the entry the target's colour
|
||||
/// comes from: a linked colour's tint swatch for that tint, or its global swatch at 100%; an unlinked colour's process
|
||||
/// swatch of that very colour. Where several entries qualify, `picked`, the swatch last picked in the popover for this
|
||||
/// Solid colors of the document's swatches (groups included), with their names, and the entry the target's color
|
||||
/// comes from: a linked color's tint swatch for that tint, or its global swatch at 100%; an unlinked color's process
|
||||
/// swatch of that very color. Where several entries qualify, `picked`, the swatch last picked in the popover for this
|
||||
/// target, is the one.
|
||||
fn swatch_colors(app: &VectorcraftApp, target: &Target, picked: Option<&PickedSwatch>) -> (Vec<(String, Color)>, Option<usize>) {
|
||||
let Some(st) = app.session.active() else { return (vec![], None) };
|
||||
@@ -295,7 +295,7 @@ fn swatch_colors(app: &VectorcraftApp, target: &Target, picked: Option<&PickedSw
|
||||
for swatch in st.doc.swatches_iter() {
|
||||
let is_picked = picked.is_some_and(|p| p.name == swatch.name);
|
||||
let Some(own) = swatch.paint.color() else { continue };
|
||||
// Picking this swatch would give the target the colour and link it has now.
|
||||
// Picking this swatch would give the target the color and link it has now.
|
||||
let source = match (link, swatch.tint_of()) {
|
||||
(Some((base, tint)), Some((of, own_tint))) => of == base && same_tint(tint, own_tint),
|
||||
(Some((base, tint)), None) => swatch.global && swatch.name == base && same_tint(tint, 1.0),
|
||||
@@ -362,7 +362,7 @@ struct Feed {
|
||||
/// Percent: the stop's location or the point's spread.
|
||||
amount: f64,
|
||||
swatches: Vec<(String, Color)>,
|
||||
/// The entry of `swatches` the target's colour comes from.
|
||||
/// The entry of `swatches` the target's color comes from.
|
||||
selected_swatch: Option<usize>,
|
||||
/// Picking the displayed swatch changes at least one edited paint.
|
||||
displayed_swatch_changes_paints: bool,
|
||||
@@ -573,8 +573,8 @@ fn swatches(ui: &mut Ui, feed: &Feed, filed: &mut Filed) {
|
||||
Notice::new(Tone::Info, tl!("The document has no colour swatches.").to_owned()).show(ui);
|
||||
return;
|
||||
}
|
||||
// Only the entry the target's colour comes from is selected, and none when no entry is: a swatch that only draws
|
||||
// the same colour, such as a spot ink an unlinked stop has the colour of, is not.
|
||||
// Only the entry the target's color comes from is selected, and none when no entry is: a swatch that only draws
|
||||
// the same color, such as a spot ink an unlinked stop has the color of, is not.
|
||||
let shown =
|
||||
SwatchPalette::new("Swatches", Bind::given(feed.current), &feed.tiles).selected_swatch(feed.selected_swatch).select_by_color(false).show(ui);
|
||||
// Every click remembers the pick. The displayed swatch applies only when an edited paint differs at this stop or point.
|
||||
@@ -795,7 +795,7 @@ pub(crate) fn pump(app: &mut VectorcraftApp, ctx: &egui::Context) {
|
||||
if filed.swatch_changes_paints {
|
||||
pick_swatch(app, &target, &name, color);
|
||||
}
|
||||
// Swatches of one colour draw alike: the Swatches view shows the one picked, not the first of them.
|
||||
// Swatches of one color draw alike: the Swatches view shows the one picked, not the first of them.
|
||||
let picked = selected(app).and_then(|target| PickedSwatch::of(app, &target, &name));
|
||||
dialogs.with(|host| {
|
||||
if let Some(popover) = host.get_mut_by_id::<GradientStopPopover>(id) {
|
||||
@@ -1018,7 +1018,7 @@ mod tests {
|
||||
let undo = panel.app().session.active().unwrap().history.undo.len();
|
||||
panel.click("First teal");
|
||||
assert_eq!(shown_swatch(&mut panel).as_deref(), Some("First teal"));
|
||||
assert_eq!(panel.app().session.active().unwrap().history.undo.len(), undo, "the same colour again is no edit");
|
||||
assert_eq!(panel.app().session.active().unwrap().history.undo.len(), undo, "the same color again is no edit");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1031,7 +1031,7 @@ pub(crate) fn recent_colors(app: &VectorcraftApp, ui: &mut Ui) -> Option<Color>
|
||||
.spacing(SwatchSpacing::Spaced)
|
||||
.drag_payload(move |drag: &ListDrag<usize>| dragged.get(drag.grabbed).map(|c| PanelDrag::paint(Paint::solid(*c))))
|
||||
.show(ui);
|
||||
// The stored colour of the cell clicked, in its own model: colours in two models can draw alike.
|
||||
// The stored color of the cell clicked, in its own model: colors in two models can draw alike.
|
||||
out.picked_swatch.and_then(|i| stored.get(i).copied())
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user