mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 02:48:12 +08:00
- Added FSM trait - Added FSM to select and ellipse tools - Moved circle stamping code to ellipse tool
This commit is contained in:
committed by
Keavon Chambers
parent
273aa652df
commit
0d6d6fb81b
@@ -27,4 +27,17 @@ impl Document {
|
||||
pub fn render(&self) -> String {
|
||||
self.svg.iter().map(|element| element.render()).collect::<Vec<_>>().join("\n")
|
||||
}
|
||||
|
||||
pub fn handle_operation<F: Fn(String)>(&mut self, operation: &Operation, update_frontend: F) {
|
||||
match *operation {
|
||||
Operation::AddCircle { cx, cy, r } => {
|
||||
self.svg.push(SvgElement::Circle(Circle {
|
||||
center: Point { x: cx, y: cy },
|
||||
radius: r,
|
||||
}));
|
||||
|
||||
update_frontend(self.render());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
pub enum Operation {
|
||||
AddCircle((f64, f64), f64),
|
||||
AddCircle { cx: f64, cy: f64, r: f64 },
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user