Slider event fixes (#1270)
* Slider: return drag_started,dragged,drag_released if value was dragged Closes https://github.com/emilk/egui/issues/1269 * Fix: DragValue correctly reports gained_focus * Make `Slider` report gained_focus,has_focus,lost_focus from DragValue Closes https://github.com/emilk/egui/issues/1268
This commit is contained in:
parent
3ed68274b0
commit
aa53522179
3 changed files with 5 additions and 2 deletions
|
@ -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).
|
||||
|
|
|
@ -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!(
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue