mirror of
https://github.com/emilk/egui.git
synced 2026-06-27 23:13:13 -04:00
Minor API tweaks
This commit is contained in:
@@ -618,7 +618,7 @@ impl Region {
|
||||
text_style: TextStyle,
|
||||
align: (Align, Align),
|
||||
text_color: Option<Color>,
|
||||
) {
|
||||
) -> Vec2 {
|
||||
let font = &self.fonts()[text_style];
|
||||
let (text, text_size) = font.layout_multiline(text, std::f32::INFINITY);
|
||||
|
||||
@@ -633,6 +633,7 @@ impl Region {
|
||||
Align::Max => pos.y - text_size.y,
|
||||
};
|
||||
self.add_text(vec2(x, y), text_style, text, text_color);
|
||||
text_size
|
||||
}
|
||||
|
||||
pub fn add_text(
|
||||
|
||||
@@ -117,6 +117,11 @@ impl Rect {
|
||||
}
|
||||
}
|
||||
|
||||
/// Expand by this much in each direction
|
||||
pub fn expand(self, amnt: f32) -> Self {
|
||||
Rect::from_center_size(self.center(), self.size() + 2.0 * vec2(amnt, amnt))
|
||||
}
|
||||
|
||||
pub fn contains(&self, p: Vec2) -> bool {
|
||||
self.pos.x <= p.x
|
||||
&& p.x <= self.pos.x + self.size.x
|
||||
|
||||
Reference in New Issue
Block a user