Skip to content

feat(tui): per-frame mouse hit-rect registry - #574

Merged
emal-avala merged 2 commits into
mainfrom
feat/mouse-hit-rect
Jul 29, 2026
Merged

feat(tui): per-frame mouse hit-rect registry#574
emal-avala merged 2 commits into
mainfrom
feat/mouse-hit-rect

Conversation

@emal-avala

Copy link
Copy Markdown
Member

Summary

  • New hit_rect module: HitRegistry, HitTarget, topmost-wins hit test, hover enter/leave.
  • Cleared at the start of every draw; composer registers its rect.
  • MouseEventKind::Moved updates 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
  • CI green

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.
@emal-avala

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +54 to +55
pub fn clear(&mut self) {
self.rects.clear();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +141 to +142
app.hit_registry
.register(chunks[6], super::hit_rect::HitTarget::Composer);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@emal-avala
emal-avala merged commit 305035f into main Jul 29, 2026
14 checks passed
@emal-avala
emal-avala deleted the feat/mouse-hit-rect branch July 29, 2026 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant