mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 05:40:03 -04:00
@@ -59,8 +59,8 @@ pub struct Response {
|
||||
|
||||
/// The intrinsic / desired size of the widget.
|
||||
///
|
||||
/// For a button, this will be the size of the label + the frames padding,
|
||||
/// even if the button is laid out in a justified layout and the actual size will be larger.
|
||||
/// This is the size that a non-wrapped, non-truncated, non-justified version of the widget
|
||||
/// would have.
|
||||
///
|
||||
/// If this is `None`, use [`Self::rect`] instead.
|
||||
///
|
||||
|
||||
@@ -220,6 +220,7 @@ impl Label {
|
||||
.rect_without_leading_space()
|
||||
.translate(pos.to_vec2());
|
||||
let mut response = ui.allocate_rect(rect, sense);
|
||||
response.intrinsic_size = Some(galley.intrinsic_size());
|
||||
for placed_row in galley.rows.iter().skip(1) {
|
||||
let rect = placed_row.rect().translate(pos.to_vec2());
|
||||
response |= ui.allocate_rect(rect, sense);
|
||||
@@ -252,7 +253,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, mut response) = ui.allocate_exact_size(galley.size(), sense);
|
||||
response.intrinsic_size = Some(galley.intrinsic_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