egui/crates
Emil Ernerfeldt f97f85089d
Prevent text shrinking in tooltips; round wrap-width to integer (#5161)
* Closes https://github.com/emilk/egui/pull/5106
* Closes https://github.com/emilk/egui/issues/5084


Protect against rounding errors in egui layout code.

Say the user asks to wrap at width 200.0.
The text layout wraps, and reports that the final width was 196.0
points.
This than trickles up the `Ui` chain and gets stored as the width for a
tooltip (say).
On the next frame, this is then set as the max width for the tooltip,
and we end up calling the text layout code again, this time with a wrap
width of 196.0.
Except, somewhere in the `Ui` chain with added margins etc, a rounding
error was introduced,
so that we actually set a wrap-width of 195.9997 instead.
Now the text that fit perfectly at 196.0 needs to wrap one word earlier,
and so the text re-wraps and reports a new width of 185.0 points.
And then the cycle continues.

So this PR limits the text wrap-width to be an integer.

Related issues:
* https://github.com/emilk/egui/issues/4927
* https://github.com/emilk/egui/issues/4928
* https://github.com/emilk/egui/issues/5163

--- 

Pleas test this @rustbasic
2024-09-25 11:31:41 +02:00
..
ecolor More compact `Debug` formatting of `Color32` (#5162) 2024-09-25 11:14:44 +02:00
eframe Wgpu render pass on paint callback has now static lifetime (#5149) 2024-09-23 11:48:09 +02:00
egui Improve documentation grammar and wording (#5052) 2024-09-22 19:15:11 +02:00
egui-wgpu Wgpu render pass on paint callback has now static lifetime (#5149) 2024-09-23 11:48:09 +02:00
egui-winit Keep track of why `request_discard` was called (#5134) 2024-09-20 09:17:52 +02:00
egui_demo_app Wgpu render pass on paint callback has now static lifetime (#5149) 2024-09-23 11:48:09 +02:00
egui_demo_lib Fix pan_zoom demo constraining windows (#5137) 2024-09-22 19:13:01 +02:00
egui_extras Fix some minor clippy lints from the future 2024-09-18 09:44:23 +02:00
egui_glow Add support for mipmap textures. (#5146) 2024-09-22 19:16:16 +02:00
egui_plot Move `egui_plot` to its own repo (#4828) 2024-07-15 18:45:19 +02:00
egui_web Fix typos (#2866) 2023-04-18 15:52:45 +02:00
emath Use `log` crate instead of `eprintln` & remove some unwraps (#5010) 2024-09-13 14:23:13 +02:00
epaint Prevent text shrinking in tooltips; round wrap-width to integer (#5161) 2024-09-25 11:31:41 +02:00
epaint_default_fonts Enable rustdoc `generate-link-to-definition` feature on docs.rs (#5030) 2024-08-30 11:22:29 +02:00