M3: rustfmt eyedropper and brush key-color UI

Co-authored-by: nrq6993-a11y <nrq6993-a11y@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-10-21 23:38:03 +07:00
committed by bflatastic
co-authored by nrq6993-a11y
parent 3f45472e15
commit b13072b77c
3 changed files with 4 additions and 13 deletions
+2 -8
View File
@@ -99,10 +99,7 @@ impl Tool for EyedropperTool {
let back = self.stop.clone().unwrap_or_else(|| "selection".to_string());
self.brush_key_color = false;
self.stop = None;
return vec![
Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&c) })),
Action::SwitchTool(back),
];
return vec![Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&c) })), Action::SwitchTool(back)];
}
let stop = self.stop.as_ref().zip(cx.gradient_stop);
// Reading a source is independent of its editability. Only Alt's reverse operation
@@ -228,10 +225,7 @@ mod tests {
let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 150.0, 150.0));
assert_eq!(
a,
vec![
Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&Color::WHITE) })),
Action::SwitchTool("selection".into())
]
vec![Action::Dialog("brushKeyColor".into(), json!({ "color": color_json(&Color::WHITE) })), Action::SwitchTool("selection".into())]
);
assert_eq!(t.options(), json!({ "stop": null, "brushKeyColor": false }));
}
@@ -25,10 +25,10 @@ use vectorcraft_color::{Color, Paint};
use vectorcraft_doc::{Appearance, Document, Node, NodeId};
use super::brush_options::{clamped, mode_key, stroke_preview};
use crate::VectorcraftApp;
use crate::state::Dialog;
use crate::theme::Tokens;
use crate::widgets;
use crate::VectorcraftApp;
/// Scatter values: (field, suffix), in [`Scatter::RANGES`] order.
const SCATTER: [(&str, &str); 4] = [("size", "%"), ("spacing", "%"), ("scatter", "%"), ("rotation", "°")];
+1 -4
View File
@@ -1119,9 +1119,6 @@ mod tests {
let texts = Panel::new().frame(&mut app, vec![], Modifiers::NONE);
assert!(texts.iter().any(|(t, _)| t == "#FFFFFF"), "the stop's colour row: {texts:?}");
stop_eyedropper(&mut app);
assert_eq!(
(app.session.tool_id(), app.session.tool_options()),
("eyedropper", json!({"stop": "gradient", "brushKeyColor": false}))
);
assert_eq!((app.session.tool_id(), app.session.tool_options()), ("eyedropper", json!({"stop": "gradient", "brushKeyColor": false})));
}
}