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

Fix: centered horizontal layouts should never overflow upwards

This commit is contained in:
Emil Ernerfeldt
2021-03-21 10:31:18 +01:00
parent cc5ad1505c
commit ec9f374d8c
3 changed files with 56 additions and 9 deletions

View File

@@ -287,10 +287,21 @@ impl Rect {
self.max.y..=self.min.y
}
#[deprecated = "Use is_negative instead"]
pub fn is_empty(&self) -> bool {
self.max.x < self.min.x || self.max.y < self.min.y
}
/// `max.x < min.x` or `max.y < min.y`.
pub fn is_negative(&self) -> bool {
self.max.x < self.min.x || self.max.y < self.min.y
}
/// `min.x <= max.x && min.y <= max.y`.
pub fn is_non_negative(&self) -> bool {
self.min.x <= self.max.x && self.min.y <= self.max.y
}
/// True if all members are also finite.
pub fn is_finite(&self) -> bool {
self.min.is_finite() && self.max.is_finite()