makepad_vector/path/
line_path_command.rs

1use crate::geometry::{Point, Transform, Transformation};
2
3/// A command in a line path
4#[derive(Clone, Copy, Debug, PartialEq)]
5pub enum LinePathCommand {
6    MoveTo(Point),
7    LineTo(Point),
8    Close,
9}
10
11impl Transform for LinePathCommand {
12    fn transform<T>(self, t: &T) -> LinePathCommand
13    where
14        T: Transformation,
15    {
16        match self {
17            LinePathCommand::MoveTo(p) => LinePathCommand::MoveTo(p.transform(t)),
18            LinePathCommand::LineTo(p) => LinePathCommand::LineTo(p.transform(t)),
19            LinePathCommand::Close => LinePathCommand::Close,
20        }
21    }
22
23    fn transform_mut<T>(&mut self, t: &T)
24    where
25        T: Transformation,
26    {
27        *self = self.transform(t);
28    }
29}