1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Add Rect::from_pos

This commit is contained in:
Emil Ernerfeldt
2024-06-19 11:27:33 +02:00
parent 159f8360fa
commit 902b4d960d

View File

@@ -110,6 +110,15 @@ impl Rect {
}
}
/// A zero-sized rect at a specific point.
#[inline]
pub fn from_pos(point: Pos2) -> Self {
Self {
min: point,
max: point,
}
}
/// Bounding-box around the points.
pub fn from_points(points: &[Pos2]) -> Self {
let mut rect = Self::NOTHING;