use diaphragm_core::{ core_shapes::StraightPath, types::ShapeContext, ComplexShape, DrawResult, Drawable, SolverContext, }; #[derive(Copy, Clone)] pub enum BracketType { Opening, Closing, } #[derive(Clone)] pub struct Bracket { pub r#type: BracketType, } impl ComplexShape for Bracket { fn draw(&self, context: &ShapeContext, solver: &mut dyn SolverContext) -> DrawResult { let mut result = DrawResult::new(); let bounds = context.bounds(); let path = match self.r#type { BracketType::Opening => StraightPath::new(vec![ bounds.top_right(solver), bounds.top_left(solver), bounds.bottom_left(solver), bounds.bottom_right(solver), ]), BracketType::Closing => StraightPath::new(vec![ bounds.top_left(solver), bounds.top_right(solver), bounds.bottom_right(solver), bounds.bottom_left(solver), ]), }; result.push(Drawable::new(path, context.clone())); result } }