Skip to content

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

Say when a filter hides the photos of an empty grid or filmstrip

Clément L257a98267828
diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rs
index e0f00f37f..df5ca4f2c 100644
--- a/crates/ui-egui/src/panels/detail.rs
+++ b/crates/ui-egui/src/panels/detail.rs
@@ -1219,6 +1219,11 @@ pub(crate) fn filmstrip(app: &mut LightcraftApp, ui: &mut egui::Ui, r: Rect) {
let active = app.session.selection.active;
let cell_w = 120.0;
let ppp = ui.ctx().pixels_per_point();
+ if ids.is_empty() {
+ let why = if app.session.filter != Default::default() { "No photos match the filters (View → Clear Filters)" } else { "No photos" };
+ ui.painter().text(r.center(), Align2::CENTER_CENTER, why, t.font(12.5), t.text_dim);
+ return;
+ }
let mut child = ui.new_child(egui::UiBuilder::new().max_rect(r.shrink2(vec2(0.0, 4.0))));
// a vertical mouse wheel scrolls the strip sideways (horizontal trackpad scrolls still work)
child.style_mut().always_scroll_the_only_direction = true;
diff --git a/crates/ui-egui/src/panels/grid.rs b/crates/ui-egui/src/panels/grid.rs
index c6d4f98f6..060bb620c 100644
--- a/crates/ui-egui/src/panels/grid.rs
+++ b/crates/ui-egui/src/panels/grid.rs
@@ -46,10 +46,15 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) {
}
app.canvas_rect = Some(ui.max_rect());
if ids.is_empty() {
- if app.session.source == lightcraft_engine::LibrarySource::Folder {
+ if app.session.filter != Default::default() {
+ super::empty_message(
+ ui,
+ ui.max_rect(),
+ "No matching photos",
+ "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)",
+ );
+ } else if app.session.source == lightcraft_engine::LibrarySource::Folder {
super::empty_message(ui, ui.max_rect(), "No photos in this folder", "Turn on Include subfolders, or pick another folder under Local");
- } else if app.session.filter != Default::default() {
- super::empty_message(ui, ui.max_rect(), "No matching photos", "Change the filter, or clear it (View → Clear Filters)");
} else {
super::empty_message(ui, ui.max_rect(), "No photos", "Add photos with File → Add Photos (Cmd+Shift+I), or drop them here");
}