feat(tui): per-frame mouse hit-rect registry - #574
Conversation
Add HitRegistry so renderers register (Rect, Target) each draw and mouse handlers resolve click/hover centrally. Clear every frame; register the composer; handle MouseEventKind::Moved for hover enter/leave. Foundation for the 14 register rows blocked on #558.
Expand the hit-rect registry beyond the composer so hover/click can target the status bar, queue chips/pane, and tasks pane.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a0355a918f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| pub fn clear(&mut self) { | ||
| self.rects.clear(); |
There was a problem hiding this comment.
Reconcile hover when clearing vanished targets
When a hovered widget disappears or moves during a redraw—for example, when queue chips are drained or a resize changes the layout—this clears its rectangle but leaves hover pointing to the now-nonexistent target. No leave transition is produced until the user moves the mouse again, so hover styling or behavior can remain attached to a hidden widget; reconcile the saved hover against the completed frame's registrations rather than preserving it unconditionally.
Useful? React with 👍 / 👎.
| app.hit_registry | ||
| .register(chunks[6], super::hit_rect::HitTarget::Composer); |
There was a problem hiding this comment.
Block underlying hit targets beneath overlays
When a permission modal, picker, or help overlay covers this composer, the base rectangle remains registered and no later overlay target blocks it, even though those overlays are drawn immediately afterward. Moving the mouse over the visible overlay can therefore resolve to Composer (or another underlying status/tasks/queue target), defeating the registry's topmost-wins contract; register overlay regions last or suppress the covered base targets while an overlay is active.
Useful? React with 👍 / 👎.
Summary
hit_rectmodule:HitRegistry,HitTarget, topmost-wins hit test, hover enter/leave.draw; composer registers its rect.MouseEventKind::Movedupdates hover state.Addresses #558 (primitive). Pair with #570 (mouse-capture toggle) before expanding hover UX. Widgets can register more targets incrementally.
Test plan
topmost_wins,clear_drops_rects_keeps_hover,set_hover_reports_enter_leave