fix(statusbar): cycling-list hover highlight on row re-entry

Row exit now clears the preview only when the highlight still points at
that row. Moving between rows can fire on_enter before the previous
row's on_exit, so the unconditional clear wiped a freshly highlighted
row (notably when returning to the first row). Guarding the clear fixes
the highlight not reappearing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-05 00:05:15 +03:00
commit bb54cd034f
3 changed files with 13 additions and 1 deletions

View file

@ -769,6 +769,9 @@ pub enum Message {
CycleSelect(acadrust::Handle), CycleSelect(acadrust::Handle),
/// Preview (highlight) a cycling-list row's object, or clear with `None`. /// Preview (highlight) a cycling-list row's object, or clear with `None`.
CycleHover(Option<acadrust::Handle>), CycleHover(Option<acadrust::Handle>),
/// Cursor left a cycling-list row; clear the preview only if it still
/// points at this row (guards against enter/exit event reordering).
CycleHoverExit(acadrust::Handle),
/// Dismiss the selection-cycling list box without picking. /// Dismiss the selection-cycling list box without picking.
CycleCancel, CycleCancel,
/// Toggle the selection-filter type picker open/closed. /// Toggle the selection-filter type picker open/closed.

View file

@ -3649,6 +3649,15 @@ impl OpenCADStudio {
self.tabs[i].scene.set_hover_highlight(handle); self.tabs[i].scene.set_hover_highlight(handle);
Task::none() Task::none()
} }
Message::CycleHoverExit(handle) => {
// Only clear if another row hasn't already taken the highlight;
// enter/exit can fire out of order when moving between rows.
let i = self.active_tab;
if self.tabs[i].scene.hover_highlight == Some(handle) {
self.tabs[i].scene.set_hover_highlight(None);
}
Task::none()
}
Message::CycleCancel => { Message::CycleCancel => {
self.cycle_candidates = None; self.cycle_candidates = None;
self.tabs[self.active_tab].scene.set_hover_highlight(None); self.tabs[self.active_tab].scene.set_hover_highlight(None);

View file

@ -59,7 +59,7 @@ fn item_row(handle: acadrust::Handle, label: String) -> Element<'static, Message
// Highlight the underlying object while the cursor is over this row. // Highlight the underlying object while the cursor is over this row.
mouse_area(btn) mouse_area(btn)
.on_enter(Message::CycleHover(Some(handle))) .on_enter(Message::CycleHover(Some(handle)))
.on_exit(Message::CycleHover(None)) .on_exit(Message::CycleHoverExit(handle))
.into() .into()
} }