1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Refactor Region: remember region rectangle

This will be used as a clip rectangle for generated paint commands.
This commit is contained in:
Emil Ernerfeldt
2020-04-20 00:48:54 +02:00
parent 7f85b2623b
commit 472e0b9afe
9 changed files with 128 additions and 83 deletions

View File

@@ -272,6 +272,16 @@ impl Rect {
Rect::from_min_size(self.min() + amnt, self.size())
}
// keep min
pub fn set_width(&mut self, w: f32) {
self.max.x = self.min.x + w;
}
// keep min
pub fn set_height(&mut self, h: f32) {
self.max.y = self.min.y + h;
}
pub fn contains(&self, p: Pos2) -> bool {
self.min.x <= p.x
&& p.x <= self.min.x + self.size().x