pub struct DragValue<'a> { /* private fields */ }
Expand description
A numeric value that you can change by dragging the number. More compact than a Slider
.
ui.add(egui::DragValue::new(&mut my_f32).speed(0.1));
Implementations
sourceimpl<'a> DragValue<'a>
impl<'a> DragValue<'a>
pub fn new<Num: Numeric>(value: &'a mut Num) -> Self
pub fn from_get_set(get_set_value: impl 'a + FnMut(Option<f64>) -> f64) -> Self
sourcepub fn speed(self, speed: impl Into<f64>) -> Self
pub fn speed(self, speed: impl Into<f64>) -> Self
How much the value changes when dragged one point (logical pixel).
sourcepub fn clamp_range<Num: Numeric>(self, clamp_range: RangeInclusive<Num>) -> Self
pub fn clamp_range<Num: Numeric>(self, clamp_range: RangeInclusive<Num>) -> Self
Clamp incoming and outgoing values to this range.
sourcepub fn suffix(self, suffix: impl ToString) -> Self
pub fn suffix(self, suffix: impl ToString) -> Self
Add a suffix to the number, this can be e.g. a unit (“°” or “ m“)
sourcepub fn min_decimals(self, min_decimals: usize) -> Self
pub fn min_decimals(self, min_decimals: usize) -> Self
Set a minimum number of decimals to display. Normally you don’t need to pick a precision, as the slider will intelligently pick a precision for you. Regardless of precision the slider will use “smart aim” to help the user select nice, round values.
sourcepub fn max_decimals(self, max_decimals: usize) -> Self
pub fn max_decimals(self, max_decimals: usize) -> Self
Set a maximum number of decimals to display. Values will also be rounded to this number of decimals. Normally you don’t need to pick a precision, as the slider will intelligently pick a precision for you. Regardless of precision the slider will use “smart aim” to help the user select nice, round values.
pub fn max_decimals_opt(self, max_decimals: Option<usize>) -> Self
sourcepub fn fixed_decimals(self, num_decimals: usize) -> Self
pub fn fixed_decimals(self, num_decimals: usize) -> Self
Set an exact number of decimals to display. Values will also be rounded to this number of decimals. Normally you don’t need to pick a precision, as the slider will intelligently pick a precision for you. Regardless of precision the slider will use “smart aim” to help the user select nice, round values.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for DragValue<'a>
impl<'a> !Send for DragValue<'a>
impl<'a> !Sync for DragValue<'a>
impl<'a> Unpin for DragValue<'a>
impl<'a> !UnwindSafe for DragValue<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more