adic_shape/shape/
element.rs#[derive(Debug, Clone)]
pub enum AdicEl {
Circle(CircleEl),
Path(PathEl),
Text(TextEl),
}
#[derive(Debug, Clone)]
pub struct PathEl {
pub class: Option<String>,
pub d: Vec<PathDInstruction>,
}
#[derive(Debug, Clone, Copy)]
pub enum PathDInstruction {
Move((f64, f64)),
Line((f64, f64)),
}
impl From<PathDInstruction> for String {
fn from(instruction: PathDInstruction) -> Self {
match instruction {
PathDInstruction::Move(m) => format!("M {} {}", m.0, m.1),
PathDInstruction::Line(l) => format!("L {} {}", l.0, l.1),
}
}
}
#[derive(Debug, Clone)]
pub struct CircleEl {
pub class: Option<String>,
pub cx: f64,
pub cy: f64,
pub r: f64,
}
#[derive(Debug, Clone)]
pub struct TextEl {
pub content: String,
pub class: Option<String>,
pub style: Option<String>,
pub x: f64,
pub y: f64,
pub dx: f64,
pub dy: f64,
}