ticking context menu
This commit is contained in:
@@ -54,6 +54,41 @@ impl Boundary {
|
||||
}
|
||||
}
|
||||
|
||||
pub const fn bottom_left(&self) -> Vec2 {
|
||||
Vec2::new(self.pos.x, self.pos.y + self.size.y)
|
||||
}
|
||||
|
||||
pub const fn bottom_right(&self) -> Vec2 {
|
||||
Vec2::new(self.pos.x + self.size.x, self.pos.y + self.size.y)
|
||||
}
|
||||
|
||||
pub const fn top_right(&self) -> Vec2 {
|
||||
Vec2::new(self.pos.x + self.size.x, self.pos.y)
|
||||
}
|
||||
|
||||
pub const fn center(&self) -> Vec2 {
|
||||
Vec2::new(self.pos.x + self.size.x / 2.0, self.pos.y + self.size.y / 2.0)
|
||||
}
|
||||
|
||||
pub const fn width(&self) -> f32 {
|
||||
self.size.x
|
||||
}
|
||||
|
||||
pub const fn height(&self) -> f32 {
|
||||
self.size.y
|
||||
}
|
||||
|
||||
pub const fn area(&self) -> f32 {
|
||||
self.size.x * self.size.y
|
||||
}
|
||||
|
||||
pub const fn contains_point(&self, point: Vec2) -> bool {
|
||||
point.x >= self.pos.x
|
||||
&& point.x <= self.pos.x + self.size.x
|
||||
&& point.y >= self.pos.y
|
||||
&& point.y <= self.pos.y + self.size.y
|
||||
}
|
||||
|
||||
pub const fn top(&self) -> f32 {
|
||||
self.pos.y
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user