This commit is contained in:
2025-08-24 22:44:21 -04:00
parent 880d7eca50
commit 9e751d4161
5 changed files with 11 additions and 13 deletions

View File

@@ -88,11 +88,6 @@ impl UiPos {
pub fn to_size(&self, size: Vec2) -> Vec2 {
self.anchor * size + self.offset
}
/// snaps this to a specific screen size to get actual pixel coordinates
pub fn snap(&self, size: Vec2) -> Vec2 {
self.to_size(size).round()
}
}
#[derive(Clone, Copy, Debug)]
@@ -195,6 +190,10 @@ impl UiRegion {
pub fn center(&self) -> UiPos {
UiPos::center().within(self)
}
pub fn in_size(&self, size: Vec2) -> Vec2 {
self.bot_right.to_size(size) - self.top_left.to_size(size)
}
}
#[derive(Debug)]