Slider, by default clamp to range (#789)

* Slider, by default clamp to range

* Update change log.
This commit is contained in:
Cristian Dinu 2021-10-12 15:15:32 -04:00 committed by GitHub
parent fc45b6fdf2
commit 1c4237097f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -26,6 +26,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
* By default, `DragValue`:s no longer show a tooltip when hovered. Change with `Style::explanation_tooltips`. * By default, `DragValue`:s no longer show a tooltip when hovered. Change with `Style::explanation_tooltips`.
* Smaller and nicer color picker. * Smaller and nicer color picker.
* `ScrollArea` will auto-shrink to content size unless told otherwise using `ScollArea::auto_shrink`. * `ScrollArea` will auto-shrink to content size unless told otherwise using `ScollArea::auto_shrink`.
* By default, `Slider`'s `clamp_to_range` is set to true.
### Fixed 🐛 ### Fixed 🐛
* Fix wrongly sized multiline `TextEdit` in justified layouts. * Fix wrongly sized multiline `TextEdit` in justified layouts.

View file

@ -95,7 +95,7 @@ impl<'a> Slider<'a> {
smallest_positive: 1e-6, smallest_positive: 1e-6,
largest_finite: f64::INFINITY, largest_finite: f64::INFINITY,
}, },
clamp_to_range: false, clamp_to_range: true,
smart_aim: true, smart_aim: true,
show_value: true, show_value: true,
prefix: Default::default(), prefix: Default::default(),
@ -163,7 +163,7 @@ impl<'a> Slider<'a> {
} }
/// If set to `true`, all incoming and outgoing values will be clamped to the slider range. /// If set to `true`, all incoming and outgoing values will be clamped to the slider range.
/// Default: `false`. /// Default: `true`.
pub fn clamp_to_range(mut self, clamp_to_range: bool) -> Self { pub fn clamp_to_range(mut self, clamp_to_range: bool) -> Self {
self.clamp_to_range = clamp_to_range; self.clamp_to_range = clamp_to_range;
self self