1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00

Fix left alignment of widgets and tweak style slightly

This commit is contained in:
Emil Ernerfeldt
2020-04-23 00:17:37 +02:00
parent a4db437413
commit fd8180cea4
8 changed files with 56 additions and 53 deletions

View File

@@ -343,16 +343,21 @@ impl Rect {
}
}
// keep min
/// keep min
pub fn set_width(&mut self, w: f32) {
self.max.x = self.min.x + w;
}
// keep min
/// keep min
pub fn set_height(&mut self, h: f32) {
self.max.y = self.min.y + h;
}
/// Keep size
pub fn set_center(&mut self, center: Pos2) {
*self = self.translate(center - self.center());
}
pub fn contains(&self, p: Pos2) -> bool {
self.min.x <= p.x
&& p.x <= self.min.x + self.size().x