pub struct Slider { /* private fields */ }Expand description
Slider component
§Example
use armas_basic::components::Slider;
let mut value = 50.0;
let response = Slider::new(0.0, 100.0)
.label("Volume")
.show(ui, &mut value);
if response.changed {
// value was modified
}Implementations§
Source§impl Slider
impl Slider
Sourcepub fn id(self, id: impl Into<Id>) -> Self
pub fn id(self, id: impl Into<Id>) -> Self
Set ID for state persistence (useful for demos where slider is recreated each frame)
Sourcepub const fn show_value(self, show: bool) -> Self
pub const fn show_value(self, show: bool) -> Self
Show or hide the value label
Sourcepub fn suffix(self, suffix: impl Into<String>) -> Self
pub fn suffix(self, suffix: impl Into<String>) -> Self
Set a suffix for the value (e.g., “%”, “ms”, “dB”)
Sourcepub const fn default_value(self, value: f32) -> Self
pub const fn default_value(self, value: f32) -> Self
Set a default value for double-click reset
Sourcepub const fn velocity_mode(self, enabled: bool) -> Self
pub const fn velocity_mode(self, enabled: bool) -> Self
Enable velocity-based dragging mode
When enabled, holding Ctrl/Cmd while dragging uses velocity mode where faster mouse movement = larger value changes. This allows for fine-grained control.
Sourcepub const fn sensitivity(self, sensitivity: f64) -> Self
pub const fn sensitivity(self, sensitivity: f64) -> Self
Set the sensitivity for velocity mode (default: 1.0)
Higher values = more responsive to mouse speed
Sourcepub fn show(self, ui: &mut Ui, value: &mut f32) -> SliderResponse
pub fn show(self, ui: &mut Ui, value: &mut f32) -> SliderResponse
Show the slider
Auto Trait Implementations§
impl Freeze for Slider
impl RefUnwindSafe for Slider
impl Send for Slider
impl Sync for Slider
impl Unpin for Slider
impl UnsafeUnpin for Slider
impl UnwindSafe for Slider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more