From b99bd447851df21f10a394bd61af7809aa5bba67 Mon Sep 17 00:00:00 2001 From: Fridtjof Michels Date: Tue, 3 Nov 2026 21:08:25 +0100 Subject: [PATCH 1/2] =?UTF-8?q?LR-VIEW-SURVEY:=20the=20=C3=97=20on=20a=20s?= =?UTF-8?q?urvey=20tile=20stays=20clickable=20while=20the=20pointer=20is?= =?UTF-8?q?=20on=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The × was drawn only while the tile was hovered; the pointer on the × took that hover, so the × vanished before the click landed. It now shows while the pointer is in the tile. Root cause and fix idea from #1639. Co-Authored-By: SarimSyed --- crates/ui-egui/src/panels/compare.rs | 5 +++-- crates/ui-egui/src/tests/compare.rs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/compare.rs b/crates/ui-egui/src/panels/compare.rs index b7034f3a6db..229ed0f653f 100644 --- a/crates/ui-egui/src/panels/compare.rs +++ b/crates/ui-egui/src/panels/compare.rs @@ -581,8 +581,9 @@ pub fn show_survey(app: &mut LightcraftApp, ui: &mut egui::Ui) { let _ = app.run("library.select", json!({"ids": [id.0]})); app.ui.view = ViewMode::Detail; } - // remove from the survey (deselect) on hover - if resp.hovered() && photos.len() > 1 { + // remove from the survey (deselect) on hover; the × stays while the pointer is on it, where + // the tile has lost its hover to the × (tied to `hovered()`, it vanished before a click landed) + if resp.contains_pointer() && photos.len() > 1 { let xr = Rect::from_min_size(pos2(img.right() - 26.0, img.top() + 6.0), vec2(20.0, 20.0)); let xresp = ui.interact(xr, egui::Id::unique(("survey-x", id.0)), Sense::click()).on_hover_text(crate::i18n::tr("Remove from survey")); crate::widgets::announce(&xresp, crate::i18n::tr("Remove from survey")); diff --git a/crates/ui-egui/src/tests/compare.rs b/crates/ui-egui/src/tests/compare.rs index f570df33a8f..621eea975af 100644 --- a/crates/ui-egui/src/tests/compare.rs +++ b/crates/ui-egui/src/tests/compare.rs @@ -405,6 +405,22 @@ fn survey_command_click_takes_the_photo_out() { assert_eq!((sel(&h), active(&h)), (vec![a], Some(a)), "the last photo stays in the survey"); } +/// The × in a survey tile's corner takes the photo out of the survey. It shows while the pointer is +/// over the tile, and it must stay while the pointer is on the × itself (#1639, #3614): the tile +/// loses its hover to the ×, and an × tied to that hover vanished before the click landed. +#[test] +fn survey_x_takes_the_photo_out() { + let mut h = demo(); + let [a, b, c] = survey_of_three(&mut h); + let tile = h.app.widgets.iter().find(|(w, _)| *w == format!("cull:{c}")).map(|(_, r)| *r).expect("the tile is laid out"); + // hover the tile first, as a person does, so the × appears; then click the × in its corner + h.app.synthetic.push(egui::Event::PointerMoved(tile.center())); + h.settle(SETTLE); + click_with(&mut h, egui::pos2(tile.right() - 16.0, tile.top() + 16.0), egui::Modifiers::NONE); + let sel: Vec = h.app.session.selection.ids.iter().map(|p| p.0).collect(); + assert_eq!(sel, vec![a, b], "the photo whose × was clicked left the survey"); +} + /// ⌘/Ctrl-click on the active survey photo while others remain: it leaves, and the last /// remaining photo becomes active, so the keys still act on a photo on screen. #[test] From ed6dd3c22db8a1cd5721fd855c74d1a05159b16e Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Thu, 5 Nov 2026 04:42:25 +0100 Subject: [PATCH 2/2] =?UTF-8?q?survey=20=C3=97=20test:=20active=20photo=20?= =?UTF-8?q?stays=20or=20moves=20on,=20and=20removing=20the=20active=20tile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/ui-egui/src/tests/compare.rs | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/tests/compare.rs b/crates/ui-egui/src/tests/compare.rs index 621eea975af..0baffa06b63 100644 --- a/crates/ui-egui/src/tests/compare.rs +++ b/crates/ui-egui/src/tests/compare.rs @@ -405,6 +405,15 @@ fn survey_command_click_takes_the_photo_out() { assert_eq!((sel(&h), active(&h)), (vec![a], Some(a)), "the last photo stays in the survey"); } +/// Hover photo `id`'s survey tile, as a person does, so its × appears; then click the × in its corner. +fn click_x(h: &mut Headless, id: u64) { + let name = format!("cull:{id}"); + let tile = h.app.widgets.iter().find(|(w, _)| *w == name).map(|(_, r)| *r).expect("the tile is laid out"); + h.app.synthetic.push(egui::Event::PointerMoved(tile.center())); + h.settle(SETTLE); + click_with(h, egui::pos2(tile.right() - 16.0, tile.top() + 16.0), egui::Modifiers::NONE); +} + /// The × in a survey tile's corner takes the photo out of the survey. It shows while the pointer is /// over the tile, and it must stay while the pointer is on the × itself (#1639, #3614): the tile /// loses its hover to the ×, and an × tied to that hover vanished before the click landed. @@ -412,13 +421,21 @@ fn survey_command_click_takes_the_photo_out() { fn survey_x_takes_the_photo_out() { let mut h = demo(); let [a, b, c] = survey_of_three(&mut h); - let tile = h.app.widgets.iter().find(|(w, _)| *w == format!("cull:{c}")).map(|(_, r)| *r).expect("the tile is laid out"); - // hover the tile first, as a person does, so the × appears; then click the × in its corner - h.app.synthetic.push(egui::Event::PointerMoved(tile.center())); - h.settle(SETTLE); - click_with(&mut h, egui::pos2(tile.right() - 16.0, tile.top() + 16.0), egui::Modifiers::NONE); + click_x(&mut h, c); + let sel: Vec = h.app.session.selection.ids.iter().map(|p| p.0).collect(); + let active = h.app.session.selection.active.map(|p| p.0); + assert_eq!((sel, active), (vec![a, b], Some(b)), "the photo whose × was clicked left the survey; the active one stays active"); +} + +/// The × on the active survey photo takes it out too, and the last remaining photo becomes active, +/// as a ⌘/Ctrl-click on it does. +#[test] +fn survey_x_on_the_active_photo_activates_the_last_one() { + let mut h = demo(); + let [a, b, c] = survey_of_three(&mut h); + click_x(&mut h, b); let sel: Vec = h.app.session.selection.ids.iter().map(|p| p.0).collect(); - assert_eq!(sel, vec![a, b], "the photo whose × was clicked left the survey"); + assert_eq!((sel, h.app.session.selection.active.map(|p| p.0)), (vec![a, c], Some(c))); } /// ⌘/Ctrl-click on the active survey photo while others remain: it leaves, and the last