Implement event capturing for Slider

This commit is contained in:
Héctor Ramón Jiménez 2020-11-12 00:56:50 +01:00
parent fd275a2fee
commit c361fe48c7

View File

@ -234,6 +234,8 @@ where
if layout.bounds().contains(cursor_position) { if layout.bounds().contains(cursor_position) {
change(); change();
self.state.is_dragging = true; self.state.is_dragging = true;
return event::Status::Captured;
} }
} }
mouse::Event::ButtonReleased(mouse::Button::Left) => { mouse::Event::ButtonReleased(mouse::Button::Left) => {
@ -242,11 +244,15 @@ where
messages.push(on_release); messages.push(on_release);
} }
self.state.is_dragging = false; self.state.is_dragging = false;
return event::Status::Captured;
} }
} }
mouse::Event::CursorMoved { .. } => { mouse::Event::CursorMoved { .. } => {
if self.state.is_dragging { if self.state.is_dragging {
change(); change();
return event::Status::Captured;
} }
} }
_ => {} _ => {}