Add Frame and Overlay elements + CAD toolbar example - #61
Conversation
Replace the `Handler` enum (fn-pointer + boxed variants) with a struct wrapping a single boxed closure, and add a `HandlerFn<I, W>` trait alias (blanket-impl'd over every matching closure) for the handler bound. `interact` now takes any `impl HandlerFn` — capturing or not — and `interact_raw` attaches an already-built `Handler`, so the `ActionButton` composer can forward its stored handlers without re-wrapping. Also scale the demo UI by the window's scale factor: layout and pointer input run in logical pixels and the scene is scaled to physical pixels on render, keeping hit-testing correct and the UI crisp on HiDPI displays.
…e and overlay element
…implifying style handling
|
Warning Review limit reached
Next review available in: 15 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe PR refactors Fynix reactive callbacks and interaction handlers, adds ChangesFynix reactive and interaction core
Layout and example runtime
Interactive toolbar example
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Input
participant CadWorld
participant Fynix
participant Toolbar
participant Overlay
Input->>CadWorld: tool or dropdown action
CadWorld->>Fynix: updated world state
Fynix->>Toolbar: rebuild changed controls
Toolbar->>Overlay: create anchored dropdown
Overlay->>Input: render positioned toolbar UI
Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@crates/fynix_elements/src/lib.rs`:
- Around line 596-649: The anchor overflow and clamping logic in
resolve_anchor_offset currently assumes the local anchor coordinates start at
(0, 0), which is incorrect for nested overlays. Propagate the viewport origin
through the anchor-position computation or convert the anchor position into root
coordinates, then use that same coordinate frame for overflows and clamping
while preserving the existing flip behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: c687e88d-ca6f-43b4-ac04-2efca1de378c
📒 Files selected for processing (14)
crates/fynix/src/ctx.rscrates/fynix/src/interaction.rscrates/fynix/src/lib.rscrates/fynix/src/reactive.rscrates/fynix/src/reactive/binding.rscrates/fynix/src/reactive/watcher.rscrates/fynix_elements/src/lib.rsexamples/vello_winit_examples/examples/hello_world.rsexamples/vello_winit_examples/examples/toolbar/builders.rsexamples/vello_winit_examples/examples/toolbar/elements.rsexamples/vello_winit_examples/examples/toolbar/helpers.rsexamples/vello_winit_examples/examples/toolbar/main.rsexamples/vello_winit_examples/examples/toolbar/theme.rsexamples/vello_winit_examples/src/lib.rs
Resolve #26
New Elements (
fynix_elements)Frame
A decorative container that wraps a single child with: (Frame draws a background fill with rounded corners around its child; Pad is invisible spacing only.)
Handles the common pattern of drawing a filled rounded rectangle behind content.
Overlay
A positioning container designed for popups, tooltips, and dropdowns. Overlay walks up the parent tree from the anchor element to compute its absolute position, then places its content at that spot.
Features:
New Example: CAD Toolbar
Added a comprehensive CAD toolbar example demonstrating Fynix's UI capabilities:
ToolButtonIconLabelButtonMenuBarItemFrameandOverlayelementsFeatures Demonstrated