mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-20 21:36:09 +08:00
Implement Pen Tool (#79)
This commit is contained in:
committed by
Keavon Chambers
parent
b556dd6bfd
commit
e40727e914
@@ -1,3 +1,5 @@
|
||||
use layers::PolyLine;
|
||||
|
||||
use crate::{
|
||||
layers::{self, Folder, Layer, LayerData, LayerDataTypes, Line, Rect, Shape},
|
||||
DocumentError, LayerId, Operation,
|
||||
@@ -178,6 +180,12 @@ impl Document {
|
||||
|
||||
update_frontend(self.render(&mut vec![]));
|
||||
}
|
||||
Operation::AddPen { path, insert_index, points, style } => {
|
||||
let points: Vec<kurbo::Point> = points.into_iter().map(|it| it.into()).collect();
|
||||
let polyline = PolyLine::new(points, style);
|
||||
self.add_layer(&path, Layer::new(LayerDataTypes::PolyLine(polyline)), insert_index)?;
|
||||
update_frontend(self.render(&mut vec![]));
|
||||
}
|
||||
Operation::AddShape {
|
||||
path,
|
||||
insert_index,
|
||||
|
||||
Reference in New Issue
Block a user