-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Area
sizing with dynamic content
#5138
Comments
This diff proposed by @emilk improves the situation a bit. However, it means the the text will no longer wrap should its length grow, which can be an issue. egui::menu::menu_button(ui, "BTN", |ui| {
+ ui.with_layout(egui::Layout::top_down(egui::Align::LEFT), |ui| {
+ ui.set_max_height(400.0);
ui.radio_value(&mut self.b, false, "False");
ui.radio_value(&mut self.b, true, "True");
if self.b {
egui::ScrollArea::vertical().show(ui, |ui| {
+ ui.style_mut().wrap_mode = Some(egui::TextWrapMode::Extend);
for _ in row_count {
ui.add_space(30.0);
ui.label("Veeeeeeeeeeeery long text.");
}
});
}
+ });
}) |
I'm having the same problem in my app, my workaround is to call this at the beginning of the Area: let screen_size = ui.ctx().screen_rect().size();
ui.set_max_size(screen_size); But I think this is pretty ugly, maybe we can add a |
There are two problems here, one that is trivial, the other which is not. Trivial problem: Why is the
|
Area
sizing with dynamic content
Affects `.on_hover_text(…)` with dynamic content (i.e. content that changes over time). * Closes #5167 `.on_hover_ui` with dynamic content can still hit the shrinking problem. The general solution depends on solving #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); // … }); ```
Affects `.on_hover_text(…)` with dynamic content (i.e. content that changes over time). * Closes emilk#5167 `.on_hover_ui` with dynamic content can still hit the shrinking problem. The general solution depends on solving emilk#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); // … }); ```
The primary thing we want to try is to add extra book keeping to |
Consider this example, which (maybe naively) tries to display a popup menu with content that can change over time:
It results in something along these lines:
Export-1726816792556.mp4
The popup menu/scroll bar combination needs a way to react (entire automatically or at least by way of an API) to the change of content size and resize if appropriate.
The text was updated successfully, but these errors were encountered: