mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Fix labels, propagate preferred size in scrollareas and add more examples from the issue
This commit is contained in:
@@ -1245,7 +1245,7 @@ impl Prepared {
|
||||
}
|
||||
}
|
||||
|
||||
ui.advance_cursor_after_rect(outer_rect, Vec2::ZERO); // TODO
|
||||
ui.advance_cursor_after_rect(outer_rect, content_ui.placer().intrinsic_size());
|
||||
|
||||
if show_scroll_this_frame != state.show_scroll {
|
||||
ui.ctx().request_repaint();
|
||||
|
||||
@@ -214,6 +214,7 @@ impl Label {
|
||||
assert!(!galley.rows.is_empty(), "Galleys are never empty");
|
||||
// collect a response from many rows:
|
||||
let rect = galley.rows[0].rect.translate(vec2(pos.x, pos.y));
|
||||
dbg!(galley.desired_size());
|
||||
let mut response = ui.allocate_rect(rect, sense, galley.desired_size());
|
||||
for row in galley.rows.iter().skip(1) {
|
||||
let rect = row.rect.translate(vec2(pos.x, pos.y));
|
||||
@@ -247,7 +248,8 @@ impl Label {
|
||||
};
|
||||
|
||||
let galley = ui.fonts(|fonts| fonts.layout_job(layout_job));
|
||||
let (rect, response) = ui.allocate_exact_size(galley.size(), sense);
|
||||
let (rect, response) =
|
||||
ui.allocate_at_least(galley.size(), sense, galley.desired_size()); // TODO: Change back to allocate_exact_size
|
||||
let galley_pos = match galley.job.halign {
|
||||
Align::LEFT => rect.left_top(),
|
||||
Align::Center => rect.center_top(),
|
||||
|
||||
Reference in New Issue
Block a user