-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
UIAll things user interface relatedAll things user interface relatedenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework
Description
Overview
Add event propagation system for UI that handles focus, hover tracking, and
input event routing to the correct widget.
Current State
No response
Scope
Goals:
- Focus management (which widget receives keyboard input)
- Hover tracking for mouse enter/leave
- Event bubbling (child to parent)
- Event capture (parent before child)
Non-Goals:
- Custom event types
- Event cancellation
Proposed API
pub struct UiContext {
root: Box<dyn Widget>,
focused: Option<WidgetId>,
hovered: Option<WidgetId>,
}
impl UiContext {
pub fn new(root: impl Widget + 'static) -> Self;
pub fn handle_mouse_move(&mut self, x: f32, y: f32);
pub fn handle_mouse_button(&mut self, button: Button, pressed: bool);
pub fn handle_key(&mut self, key: Key);
pub fn set_focus(&mut self, widget: WidgetId);
pub fn focused(&self) -> Option<WidgetId>;
pub fn render(&mut self, ctx: &mut RenderContext) -> Vec<RenderCommand>;
}Acceptance Criteria
- Click sets focus to clicked widget
- Tab key moves focus to next widget
- Keyboard events go to focused widget
- Mouse enter/leave tracked for hover states
- Parent widgets can intercept events
Affected Crates
lambda-rs
Notes
- Widget IDs needed for focus tracking
- Consider focus order (tab index)
Metadata
Metadata
Assignees
Labels
UIAll things user interface relatedAll things user interface relatedenhancementNew feature or requestNew feature or requestlambda-rsIssues pertaining to the core frameworkIssues pertaining to the core framework