mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
Simplify and unify queries about available space
This commit is contained in:
@@ -382,13 +382,13 @@ impl Rect {
|
||||
/// Expand by this much in each direction, keeping the center
|
||||
#[must_use]
|
||||
pub fn expand(self, amnt: f32) -> Self {
|
||||
Rect::from_center_size(self.center(), self.size() + 2.0 * vec2(amnt, amnt))
|
||||
self.expand2(Vec2::splat(amnt))
|
||||
}
|
||||
|
||||
/// Expand by this much in each direction, keeping the center
|
||||
#[must_use]
|
||||
pub fn expand2(self, amnt: Vec2) -> Self {
|
||||
Rect::from_center_size(self.center(), self.size() + 2.0 * amnt)
|
||||
Rect::from_min_max(self.min - amnt, self.max + amnt)
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
|
||||
Reference in New Issue
Block a user