mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Refactor: replace bounding_size: Vec2 with child_bounds: Rect
This commit is contained in:
@@ -392,6 +392,7 @@ impl Rect {
|
||||
*self = self.translate(center - self.center());
|
||||
}
|
||||
|
||||
#[must_use]
|
||||
pub fn contains(&self, p: Pos2) -> bool {
|
||||
self.min.x <= p.x
|
||||
&& p.x <= self.min.x + self.size().x
|
||||
@@ -399,6 +400,11 @@ impl Rect {
|
||||
&& p.y <= self.min.y + self.size().y
|
||||
}
|
||||
|
||||
pub fn extend_with(&mut self, p: Pos2) {
|
||||
self.min = self.min.min(p);
|
||||
self.max = self.max.max(p);
|
||||
}
|
||||
|
||||
pub fn center(&self) -> Pos2 {
|
||||
Pos2 {
|
||||
x: self.min.x + self.size().x / 2.0,
|
||||
|
||||
Reference in New Issue
Block a user