Struct DoubleSlider

Source
pub struct DoubleSlider<'a, T: Numeric> { /* private fields */ }
Expand description

Control two numbers with a double slider.

The slider range defines the values you get when pulling the slider to the far edges.

The range can include any numbers, and go from low-to-high or from high-to-low.

use egui_double_slider::DoubleSlider;

egui::__run_test_ui(|ui| {
    let mut my_val: f32 = 0.0;
    let mut my_other_val: f32 = 0.0;
        ui.add(DoubleSlider::new(&mut my_val,&mut my_other_val, 0.0..=100.0));
});

Implementations§

Source§

impl<'a, T: Numeric> DoubleSlider<'a, T>

Source

pub fn new( lower_value: &'a mut T, upper_value: &'a mut T, range: RangeInclusive<T>, ) -> Self

Source

pub fn width(self, width: f32) -> Self

Set the primary width for the slider. Default is 100.0

Source

pub fn zoom_factor(self, zoom_factor: f32) -> Self

Set the zoom factor (multiplied with cursor zoom). This depends on the responsiveness that you would like to have for zooming Default is 10.0

Source

pub fn scroll_factor(self, scroll_factor: f32) -> Self

Set the scroll factor (multiplied with cursor scroll). This depends on the responsiveness that you would like to have for scrolling Default is 0.01

Source

pub fn horizontal_scroll(self, enable: bool) -> Self

Enable the horizontal scroll axis. Default is true

Source

pub fn vertical_scroll(self, enable: bool) -> Self

Enable the vertical scroll axis. Default is true

Source

pub fn invert_highlighting(self, inverted_highlighting: bool) -> Self

Invert the highlighted part. Default is false.

Source

pub fn separation_distance(self, separation_distance: T) -> Self

Set the separation distance for the two sliders. Default is 1.

Source

pub fn color(self, color: Color32) -> Self

Set the primary color for the slider Default color is taken from inactive.bg_fill in egui::style::Widgets, the same as egui::Slider.

Source

pub fn stroke(self, stroke: Stroke) -> Self

Set the stroke for the main line. Default width is 7.0 and default color is taken from selection.bg_fill in egui::Visuals, the same as egui::Slider

Source

pub fn cursor_fill(self, cursor_fill: Color32) -> Self

Set the color fill for the slider cursor. Default fill is taken from visuals.bg_fill in egui::style::WidgetVisuals, the same as egui::Slider

Source

pub fn control_point_radius(self, control_point_radius: f32) -> Self

Set the control point radius Default is 7.0

Source

pub fn logarithmic(self, logarithmic: bool) -> Self

Use a logarithmic scale. Default is false.

Source

pub fn push_by_dragging(self, push_by_dragging: bool) -> Self

Allow to drag the lower value to the right of the upper value, and vice versa. Default is true.

Trait Implementations§

Source§

impl<'a, T: Numeric> Widget for DoubleSlider<'a, T>

Source§

fn ui(self, ui: &mut Ui) -> Response

Allocate space, interact, paint, and return a Response. Read more

Auto Trait Implementations§

§

impl<'a, T> Freeze for DoubleSlider<'a, T>
where T: Freeze,

§

impl<'a, T> RefUnwindSafe for DoubleSlider<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for DoubleSlider<'a, T>
where T: Send,

§

impl<'a, T> Sync for DoubleSlider<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for DoubleSlider<'a, T>
where T: Unpin,

§

impl<'a, T> !UnwindSafe for DoubleSlider<'a, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.