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

Reset wrapping in label tooltip (#7535)

* follow up to #7514 

That PR changed the tooltip to preserve the wrapping, which made the
tooltip kind of useless. With this PR the wrapping is reset for the
tooltip.
This commit is contained in:
Lucas Meurer
2025-09-11 17:18:53 +02:00
committed by GitHub
parent b0c568a78e
commit 2d3ecd3494
3 changed files with 10 additions and 4 deletions

View File

@@ -281,8 +281,14 @@ impl Widget for Label {
if ui.is_rect_visible(response.rect) {
if show_tooltip_when_elided && galley.elided {
// Keep the sections and text, but reset everything else (especially wrapping):
let job = crate::text::LayoutJob {
sections: galley.job.sections.clone(),
text: galley.job.text.clone(),
..crate::text::LayoutJob::default()
};
// Show the full (non-elided) text on hover:
response = response.on_hover_text(galley.job.clone());
response = response.on_hover_text(job);
}
let response_color = if interactive {