use crate::*;
pub struct Drawing {
pub shape: Option<Shape>,
pub display_list: DisplayList,
pub position: Point,
pub style: Style,
}
impl Drawing {
pub fn new() -> Drawing {
Drawing {
shape: None,
style: Style::default(),
display_list: DisplayList::new(),
position: Point::origin(),
}
}
pub fn with_shape(mut self, shape: Shape) -> Drawing {
self.shape = Some(shape);
self
}
pub fn with_style(mut self, style: Style) -> Drawing {
self.style = style;
self
}
pub fn with_position(mut self, position: Point) -> Drawing {
self.position = position;
self
}
pub fn with_xy(mut self, x: f32, y: f32) -> Drawing {
self.position = Point { x, y };
self
}
}
pub struct DisplayList {
pub drawings: Vec<Drawing>,
}
impl DisplayList {
pub fn new() -> DisplayList {
DisplayList { drawings: vec![] }
}
pub fn add(&mut self, drawing: Drawing) -> DrawingId {
let child_id = self.drawings.len();
self.drawings.push(drawing);
child_id
}
pub fn remove(&mut self, _drawing_id: DrawingId) {
unimplemented!()
}
}