#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Point {
pub x: f64,
pub y: f64,
}
impl Point {
pub fn new(x: f64, y: f64) -> Self {
Self { x, y }
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub(crate) struct ScreenPoint {
pub(crate) x: f32,
pub(crate) y: f32,
}
impl ScreenPoint {
pub(crate) fn new(x: f32, y: f32) -> Self {
Self { x, y }
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub(crate) struct ScreenRect {
pub(crate) min: ScreenPoint,
pub(crate) max: ScreenPoint,
}
impl ScreenRect {
pub(crate) fn new(min: ScreenPoint, max: ScreenPoint) -> Self {
Self { min, max }
}
pub(crate) fn width(&self) -> f32 {
self.max.x - self.min.x
}
pub(crate) fn height(&self) -> f32 {
self.max.y - self.min.y
}
pub(crate) fn is_valid(&self) -> bool {
self.width() > 0.0 && self.height() > 0.0
}
}