Skip to content

Commit

Permalink
Make sliders correctly generate events on change. (#1854)
Browse files Browse the repository at this point in the history
  • Loading branch information
ndarilek authored Jul 25, 2022
1 parent 74ccde5 commit 0913c77
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions egui/src/widgets/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,6 @@ impl<'a> Slider<'a> {
self.set_value(new_value);
}

let value = self.get_value();
response.widget_info(|| WidgetInfo::slider(value, &self.text));

if response.has_focus() {
let (dec_key, inc_key) = match self.orientation {
SliderOrientation::Horizontal => (Key::ArrowLeft, Key::ArrowRight),
Expand Down Expand Up @@ -538,7 +535,9 @@ impl<'a> Widget for Slider<'a> {
};

let mut response = inner_response.inner | inner_response.response;
response.changed = self.get_value() != old_value;
let value = self.get_value();
response.changed = value != old_value;
response.widget_info(|| WidgetInfo::slider(value, &self.text));
response
}
}
Expand Down

0 comments on commit 0913c77

Please sign in to comment.