Add on_hover_text_at_pointer (#1179)
This commit is contained in:
parent
ea28485bdd
commit
32a9b4abcc
2 changed files with 9 additions and 0 deletions
|
@ -21,6 +21,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
|
||||||
* Added `ui.data()`, `ctx.data()`, `ctx.options()` and `ctx.tessellation_options()` ([#1175](https://github.com/emilk/egui/pull/1175)).
|
* Added `ui.data()`, `ctx.data()`, `ctx.options()` and `ctx.tessellation_options()` ([#1175](https://github.com/emilk/egui/pull/1175)).
|
||||||
* Added `Plot::allow_boxed_zoom()`, `Plot::boxed_zoom_pointer()` for boxed zooming on plots ([#1188](https://github.com/emilk/egui/pull/1188)).
|
* Added `Plot::allow_boxed_zoom()`, `Plot::boxed_zoom_pointer()` for boxed zooming on plots ([#1188](https://github.com/emilk/egui/pull/1188)).
|
||||||
* Added linked axis support for plots via `plot::LinkedAxisGroup` ([#1184](https://github.com/emilk/egui/pull/1184)).
|
* Added linked axis support for plots via `plot::LinkedAxisGroup` ([#1184](https://github.com/emilk/egui/pull/1184)).
|
||||||
|
* Added `Response::on_hover_text_at_pointer` as a convenience akin to `Response::on_hover_text`. ([1179](https://github.com/emilk/egui/pull/1179))
|
||||||
|
|
||||||
### Changed 🔧
|
### Changed 🔧
|
||||||
* ⚠️ `Context::input` and `Ui::input` now locks a mutex. This can lead to a dead-lock is used in an `if let` binding!
|
* ⚠️ `Context::input` and `Ui::input` now locks a mutex. This can lead to a dead-lock is used in an `if let` binding!
|
||||||
|
|
|
@ -383,6 +383,14 @@ impl Response {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Like `on_hover_text`, but show the text next to cursor.
|
||||||
|
#[doc(alias = "tooltip")]
|
||||||
|
pub fn on_hover_text_at_pointer(self, text: impl Into<WidgetText>) -> Self {
|
||||||
|
self.on_hover_ui_at_pointer(|ui| {
|
||||||
|
ui.add(crate::widgets::Label::new(text));
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// Show this text if the widget was hovered (i.e. a tooltip).
|
/// Show this text if the widget was hovered (i.e. a tooltip).
|
||||||
///
|
///
|
||||||
/// The text will not be visible if the widget is not enabled.
|
/// The text will not be visible if the widget is not enabled.
|
||||||
|
|
Loading…
Reference in a new issue