-
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 a slider widget for selecting a numeric value within a range by dragging.
Current State
No response
Scope
Goals:
- Horizontal slider with track and thumb
- Configurable min/max/current value
- Drag to change value
- Value change callback
Non-Goals:
- Vertical slider
- Stepped values
- Multi-thumb
Proposed API
pub struct Slider {
min: f32,
max: f32,
value: f32,
on_change: Option<Box<dyn Fn(f32)>>,
}
impl Slider {
pub fn new(min: f32, max: f32, initial: f32) -> Self;
pub fn on_change(self, callback: impl Fn(f32) + 'static) -> Self;
pub fn value(&self) -> f32;
pub fn set_value(&mut self, value: f32);
pub fn normalized(&self) -> f32; // 0.0 to 1.0
}
impl Widget for Slider {
fn render(&self, ctx: &mut UiRenderContext) -> Vec<RenderCommand>;
fn hit_test(&self, x: f32, y: f32) -> bool;
}Acceptance Criteria
- Slider displays track and thumb
- Dragging thumb changes value
- Value clamped to min/max range
- Callback fires on value change
- Clicking on track jumps thumb to position
Affected Crates
lambda-rs
Notes
- Thumb position = lerp(track_start, track_end, normalized)
- Consider touch-friendly thumb size
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