use super::WindowShape;
pub struct ShapeMask {
shape: WindowShape,
width: f32,
height: f32,
offset: f32,
}
impl ShapeMask {
pub fn new(shape: WindowShape, width: f32, height: f32) -> Self {
Self { shape, width, height, offset: 0.0 }
}
pub fn new_with_offset(shape: WindowShape, width: f32, height: f32, offset: f32) -> Self {
Self { shape, width, height, offset }
}
pub fn contains(&self, x: f32, y: f32) -> bool {
let local_x = x - self.offset;
let local_y = y - self.offset;
self.shape.contains(local_x, local_y, self.width, self.height)
}
pub fn set_size(&mut self, width: f32, height: f32) {
self.width = width;
self.height = height;
}
pub fn set_shape(&mut self, shape: WindowShape) {
self.shape = shape;
}
}