diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d66952a..d59b8bfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 `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 `Response::on_hover_and_drag_cursor`. ### Changed 🔧 * Improved plot grid appearance ([#2412](https://github.com/emilk/egui/pull/2412)). diff --git a/crates/egui/src/response.rs b/crates/egui/src/response.rs index 7e108f37..072f5280 100644 --- a/crates/egui/src/response.rs +++ b/crates/egui/src/response.rs @@ -459,6 +459,14 @@ impl Response { 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). /// /// Note that this call will not add any hover-effects to the widget, so when possible