adic_shape/shape/
display_shape.rs

1use super::AdicEl;
2
3
4/// Trait for shapes that can be displayed
5pub trait DisplayShape {
6
7    /// Display-independent elements needed to draw this shape.
8    fn adic_els(&self) -> impl Iterator<Item=AdicEl>;
9
10    /// Default css class
11    fn default_class(&self) -> String;
12
13    /// Height of svg viewbox
14    fn viewbox_height(&self) -> u32;
15    /// Width of svg viewbox
16    fn viewbox_width(&self) -> u32;
17    /// Viewbox string
18    fn viewbox_str(&self) -> String {
19        [0, 0, self.viewbox_width(), self.viewbox_height()].map(|x| x.to_string()).join(" ")
20    }
21
22}