mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
cargo fmt (CI gate failed on formatting)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
0e421d6a33
commit
099195e978
2 files changed
+14
-4
No files matched your search
@@ -762,7 +762,15 @@ fn replace_color_adds_and_subtracts_samples_as_color_range_does() {
|
||||
// Red on the left (x < 16), blue in the middle, green on the right (x ≥ 32).
|
||||
let (red, blue, green) = ([0.85, 0.1, 0.1, 1.0], [0.1, 0.15, 0.85, 1.0], [0.1, 0.8, 0.15, 1.0]);
|
||||
let mut s = session(8, "rgb");
|
||||
paint(&mut s, |x, _| if x < 16 { red } else if x < 32 { blue } else { green });
|
||||
paint(&mut s, |x, _| {
|
||||
if x < 16 {
|
||||
red
|
||||
} else if x < 32 {
|
||||
blue
|
||||
} else {
|
||||
green
|
||||
}
|
||||
});
|
||||
let before = (rgba(&s, 4, 16), rgba(&s, 24, 16), rgba(&s, 40, 16));
|
||||
let shift = |extra: Value| {
|
||||
let mut p = json!({"fuzziness": 40, "hue": 120, "saturation": 20});
|
||||
|
||||
@@ -1050,9 +1050,11 @@ pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
|
||||
// puts it away.
|
||||
let armed = f.get(COLOR_EYEDROPPER).and_then(Value::as_bool).unwrap_or(false);
|
||||
let tool = f.get("__tool").and_then(Value::as_str).unwrap_or("sample").to_string();
|
||||
for (id, badge, label) in
|
||||
[("subtract", "−", tl!("Subtract from Sample")), ("add", "+", tl!("Add to Sample")), ("sample", "", tl!("Pick Color From Image"))]
|
||||
{
|
||||
for (id, badge, label) in [
|
||||
("subtract", "−", tl!("Subtract from Sample")),
|
||||
("add", "+", tl!("Add to Sample")),
|
||||
("sample", "", tl!("Pick Color From Image")),
|
||||
] {
|
||||
let on = armed && tool == id;
|
||||
if crate::color_range_ui::eyedropper(ui, badge, on, label).clicked() {
|
||||
f.insert(COLOR_EYEDROPPER.into(), json!(!on));
|
||||
|
||||
Reference in new issue
Block a user