Add on_hover_text_at_pointer (#1179)

This commit is contained in:
Juan Campa
2022-02-05 10:51:16 +01:00
committed by GitHub
parent ea28485bdd
commit 32a9b4abcc
2 changed files with 9 additions and 0 deletions
+8
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.