mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Fix bug causing tooltips with dynamic content to shrink (#5168)
Affects `.on_hover_text(…)` with dynamic content (i.e. content that changes over time). * Closes https://github.com/emilk/egui/issues/5167 `.on_hover_ui` with dynamic content can still hit the shrinking problem. The general solution depends on solving https://github.com/emilk/egui/issues/5138 but a work-around is to add this to your tooltips: ```diff response.on_hover_ui(|ui| { + ui.set_max_width(ui.spacing().tooltip_width); // … }); ```
This commit is contained in:
@@ -103,6 +103,12 @@ fn main() -> eframe::Result {
|
||||
ui.label("World");
|
||||
ui.label("Hellooooooooooooooooooooooooo");
|
||||
});
|
||||
|
||||
ui.separator();
|
||||
|
||||
let time = ui.input(|i| i.time);
|
||||
ui.label("Hover for a tooltip with changing content")
|
||||
.on_hover_text(format!("A number: {}", time % 10.0));
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user