1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 13:50:04 -04:00

Add Align2::anchor_size (#3863)

This commit is contained in:
Emil Ernerfeldt
2024-01-22 16:47:50 +01:00
committed by GitHub
parent 9fb83d3541
commit 31cc31a67b
4 changed files with 21 additions and 6 deletions

View File

@@ -229,7 +229,7 @@ impl Painter {
text: impl ToString,
) -> Rect {
let galley = self.layout_no_wrap(text.to_string(), FontId::monospace(12.0), color);
let rect = anchor.anchor_rect(Rect::from_min_size(pos, galley.size()));
let rect = anchor.anchor_size(pos, galley.size());
let frame_rect = rect.expand(2.0);
self.add(Shape::rect_filled(
frame_rect,
@@ -378,7 +378,7 @@ impl Painter {
text_color: Color32,
) -> Rect {
let galley = self.layout_no_wrap(text.to_string(), font_id, text_color);
let rect = anchor.anchor_rect(Rect::from_min_size(pos, galley.size()));
let rect = anchor.anchor_size(pos, galley.size());
self.galley(rect.min, galley, text_color);
rect
}