Merge PR #2070: Show the applied profile when hovering it in the profile browser (#2057)

This commit is contained in:
Brandon Thomas
2026-10-18 09:20:36 -04:00
2 changed files with 20 additions and 0 deletions
+17
View File
@@ -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]
+3
View File
@@ -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!(
"{} ({})",