Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Batch 32: arrows over a slider nudge it (#1264), the toast area doesn't fade in (#1262), #1282's test runs on Windows

bflatastic2e877ad47624
diff --git a/crates/ui-egui/src/panels/mod.rs b/crates/ui-egui/src/panels/mod.rs
index 7a90d5a10..7a0dfb313 100644
--- a/crates/ui-egui/src/panels/mod.rs
+++ b/crates/ui-egui/src/panels/mod.rs
@@ -90,6 +90,8 @@ pub fn toast(app: &mut LightcraftApp, ctx: &egui::Context) {
egui::Area::new(egui::Id::new("toast"))
.order(egui::Order::Foreground)
.movable(false)
+ // (the toast fades by its own clock)
+ .fade_in(false)
.pivot(Align2::CENTER_CENTER)
.fixed_pos(pos2(canvas.center().x, canvas.bottom() - 60.0))
.show(ctx, |ui| {
diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs
index 01c6c03ad..1a21ab2fc 100644
--- a/crates/ui-egui/src/shortcuts.rs
+++ b/crates/ui-egui/src/shortcuts.rs
@@ -538,6 +538,12 @@ pub fn handle(app: &mut LightcraftApp, ctx: &egui::Context) {
}
// Up / Down in the grids go to the cell above / below (the filmstrip steps one photo)
if matches!(f.as_str(), "library.up" | "library.down") {
+ // over a slider the arrows nudge it (widgets::slider takes the key)
+ let over_slider =
+ ctx.pointer_hover_pos().is_some_and(|p| app.widgets.iter().any(|(id, r)| id.starts_with("slider:") && r.contains(p)));
+ if over_slider {
+ continue;
+ }
match crate::panels::grid::row_distance(app, f == "library.down") {
Some(0) => {}
Some(rows) => {
diff --git a/crates/ui-egui/src/tests_labels.rs b/crates/ui-egui/src/tests_labels.rs
index 9325ab77e..9869223b4 100644
--- a/crates/ui-egui/src/tests_labels.rs
+++ b/crates/ui-egui/src/tests_labels.rs
@@ -75,6 +75,8 @@ fn label_tints_grid_and_filmstrip_chrome_without_changing_photo_pixels() {
fn label_toast_has_pale_colour_and_rating_restores_neutral_style() {
let mut h = app(ViewMode::SquareGrid);
h.app.run("photo.label", json!({"label": "red"})).unwrap();
+ // (two frames: the toast is an egui Area, sized in its first frame and painted from the second, #1262)
+ h.step();
h.step();
let at = egui::pos2(h.app.canvas_rect.unwrap().center().x, h.app.canvas_rect.unwrap().bottom() - 45.0);
let red = pixel(&h.paint(), at);
diff --git a/crates/ui-egui/src/tests_panels.rs b/crates/ui-egui/src/tests_panels.rs
index 440621346..b18c4e968 100644
--- a/crates/ui-egui/src/tests_panels.rs
+++ b/crates/ui-egui/src/tests_panels.rs
@@ -1727,8 +1727,8 @@ fn a_folder_menu_locates_its_missing_tree_only() {
std::fs::write(path, b"photo").unwrap();
}
- let root = base.to_string_lossy().replace('\\', "/");
- let old = format!("{root}/old");
+ // (the missing tree is not on disk: a plain root, so the Folders section lists it the same on every platform)
+ let old = "/lc-locate-old".to_string();
let old_trip = format!("{old}/trip");
let paths = [format!("{old_trip}/a.jpg"), format!("{old_trip}/day2/b.jpg"), format!("{old}/other/c.jpg")];
let picked = new_trip.to_string_lossy().to_string();
@@ -1756,7 +1756,7 @@ fn a_folder_menu_locates_its_missing_tree_only() {
})
.collect();
assert!(sources.contains(&new_trip.join("a.jpg").to_string_lossy().to_string()), "{sources:?}");
- assert!(sources.contains(&new_trip.join("day2/b.jpg").to_string_lossy().to_string()), "{sources:?}");
+ assert!(sources.contains(&new_trip.join("day2").join("b.jpg").to_string_lossy().to_string()), "{sources:?}");
assert!(sources.contains(&format!("{old}/other/c.jpg")), "another missing folder stays untouched: {sources:?}");
}