1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Add on_hover_text_at_pointer (#1179)

This commit is contained in:
Juan Campa
2022-02-05 04:51:16 -05:00
committed by GitHub
parent ea28485bdd
commit 32a9b4abcc
2 changed files with 9 additions and 0 deletions

View File

@@ -383,6 +383,14 @@ impl Response {
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).
///
/// The text will not be visible if the widget is not enabled.