LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Show the applied profile when hovering it in the profile browser (#2057)
MarekSpodBiedry5be931e48a72
diff --git a/crates/ui-egui/src/headless.rs b/crates/ui-egui/src/headless.rsindex 6178990b0..74a907127 100644--- a/crates/ui-egui/src/headless.rs+++ b/crates/ui-egui/src/headless.rs@@ -1772,6 +1772,23 @@ mod tests {h.settle(SETTLE);}+ /// Hovering the applied profile shows the applied look (no preview), not the last other profile hovered.+ #[test]+ fn hovering_the_applied_profile_drops_the_last_hover() {+ let mut h = demo([1400.0, 900.0]);+ let t = Duration::from_secs(10);+ h.request("ui.set", json!({"view": "detail"}), t);+ h.request("engine.execute", json!({"command": "panel.profiles"}), t);+ h.settle(SETTLE);+ h.request("ui.clickWidget", json!({"id": "profileCell:lc.vivid"}), t);+ h.request("ui.hoverWidget", json!({"id": "profileCell:lc.portrait"}), t);+ h.step();+ assert!(h.app.hover_preview.is_some(), "another profile previews");+ h.request("ui.hoverWidget", json!({"id": "profileCell:lc.vivid"}), t);+ h.step();+ assert!(h.app.hover_preview.is_none(), "the applied profile is shown, not the last hovered one");+ }+/// Presets column: resting on a preset previews it in the loupe without a history entry;/// thumbnails are variant renders; Create Preset includes only the checked groups.#[test]diff --git a/crates/ui-egui/src/panels/profiles.rs b/crates/ui-egui/src/panels/profiles.rsindex dac064d19..8a4b08345 100644--- a/crates/ui-egui/src/panels/profiles.rs+++ b/crates/ui-egui/src/panels/profiles.rs@@ -188,6 +188,9 @@ fn cell_ui(app.hover_preview =Some(HoverPreview { label: crate::i18n::tr_format!("Profile: {}", crate::i18n::profile_label(p_id, p_name)), settings: s.clone() });ui.data_mut(|m| m.insert_temp(egui::Id::new("last-profile-hover"), (id, p_id.to_string())));+ } else if resp.hovered() && applied {+ // resting on the applied profile shows it (no preview), not the last other profile hovered+ ui.data_mut(|m| m.remove::<(PhotoId, String)>(egui::Id::new("last-profile-hover")));}let resp = resp.on_hover_text(format!("{} ({})",