Add Response::on_hover_and_drag_cursor

This commit is contained in:
Emil Ernerfeldt 2022-12-21 17:47:52 +01:00
parent a68c891092
commit fa0d7f7f7f
2 changed files with 9 additions and 0 deletions

View file

@ -11,6 +11,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
* Add `Memory::any_popup_open`, which returns true if any popup is currently open ([#2464](https://github.com/emilk/egui/pull/2464)). * Add `Memory::any_popup_open`, which returns true if any popup is currently open ([#2464](https://github.com/emilk/egui/pull/2464)).
* Add `Plot::clamp_grid` to only show grid where there is data ([#2480](https://github.com/emilk/egui/pull/2480)). * Add `Plot::clamp_grid` to only show grid where there is data ([#2480](https://github.com/emilk/egui/pull/2480)).
* Add `ScrollArea::drag_to_scroll` if you want to turn off that feature. * Add `ScrollArea::drag_to_scroll` if you want to turn off that feature.
* Add `Response::on_hover_and_drag_cursor`.
### Changed 🔧 ### Changed 🔧
* Improved plot grid appearance ([#2412](https://github.com/emilk/egui/pull/2412)). * Improved plot grid appearance ([#2412](https://github.com/emilk/egui/pull/2412)).

View file

@ -459,6 +459,14 @@ impl Response {
self self
} }
/// When hovered or dragged, use this icon for the mouse cursor.
pub fn on_hover_and_drag_cursor(self, cursor: CursorIcon) -> Self {
if self.hovered() || self.dragged() {
self.ctx.output().cursor_icon = cursor;
}
self
}
/// Check for more interactions (e.g. sense clicks on a [`Response`] returned from a label). /// Check for more interactions (e.g. sense clicks on a [`Response`] returned from a label).
/// ///
/// Note that this call will not add any hover-effects to the widget, so when possible /// Note that this call will not add any hover-effects to the widget, so when possible