1
0
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:
Emil Ernerfeldt
2020-05-12 18:21:09 +02:00
parent 6f7bc3cfac
commit 7a1c97ccfe
15 changed files with 91 additions and 108 deletions

View File

@@ -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]