diff --git a/CHANGELOG.md b/CHANGELOG.md index fa7b174b..3a7ca6bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w * Calling `Context::set_pixels_per_point` before the first frame will now work. * Tooltips that don't fit the window don't flicker anymore ([#1240](https://github.com/emilk/egui/pull/1240)). * Scroll areas now follow text cursor ([1252](https://github.com/emilk/egui/pull/1252)). +* Slider: correctly respond with drag and focus events when interacting with the value directly ([1270](https://github.com/emilk/egui/pull/1270)). ### Contributors 🙏 * [AlexxxRu](https://github.com/alexxxru): [#1108](https://github.com/emilk/egui/pull/1108). diff --git a/egui/src/response.rs b/egui/src/response.rs index 5478fe10..29bb5626 100644 --- a/egui/src/response.rs +++ b/egui/src/response.rs @@ -510,6 +510,8 @@ impl Response { impl Response { /// A logical "or" operation. /// For instance `a.union(b).hovered` means "was either a or b hovered?". + /// + /// The resulting [`Self::id`] will come from the first (`self`) argument. pub fn union(&self, other: Self) -> Self { assert!(self.ctx == other.ctx); crate::egui_assert!( diff --git a/egui/src/widgets/slider.rs b/egui/src/widgets/slider.rs index f9285fe2..23480abe 100644 --- a/egui/src/widgets/slider.rs +++ b/egui/src/widgets/slider.rs @@ -507,10 +507,10 @@ impl<'a> Slider<'a> { { // Use the `DragValue` id as the id of the whole widget, // so that the focus events work as expected. - response = value_response | response; + response = value_response.union(response); } else { // Use the slider id as the id for the whole widget - response = response | value_response; + response = response.union(value_response); } }