1
0
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:
Emil Ernerfeldt
2020-04-25 15:46:50 +02:00
parent cce048509f
commit 649dcec09c
10 changed files with 37 additions and 24 deletions

View File

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