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) {
change();
self.state.is_dragging = true;
return event::Status::Captured;
}
}
mouse::Event::ButtonReleased(mouse::Button::Left) => {
@ -242,11 +244,15 @@ where
messages.push(on_release);
}
self.state.is_dragging = false;
return event::Status::Captured;
}
}
mouse::Event::CursorMoved { .. } => {
if self.state.is_dragging {
change();
return event::Status::Captured;
}
}
_ => {}