mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 07:48:13 +08:00
Implement bounding box for selected layers (#349)
* Implement bounding box for selected layers * Add shift modifier for multi selection
This commit is contained in:
committed by
Keavon Chambers
parent
7c64e1a816
commit
68d8ae4804
@@ -33,7 +33,7 @@ fn split_path(path: &[LayerId]) -> Result<(&[LayerId], LayerId), DocumentError>
|
||||
}
|
||||
|
||||
impl Document {
|
||||
pub fn with_content(serialized_content: &String) -> Result<Self, DocumentError> {
|
||||
pub fn with_content(serialized_content: &str) -> Result<Self, DocumentError> {
|
||||
serde_json::from_str(serialized_content).map_err(|e| DocumentError::InvalidFile(e.to_string()))
|
||||
}
|
||||
|
||||
@@ -289,8 +289,10 @@ impl Document {
|
||||
Operation::AddBoundingBox { path, transform, style } => {
|
||||
let mut rect = Shape::rectangle(*style);
|
||||
rect.render_index = -1;
|
||||
self.set_layer(path, Layer::new(LayerDataType::Shape(rect), *transform), -1)?;
|
||||
Some(vec![DocumentResponse::DocumentChanged])
|
||||
let mut layer = Layer::new(LayerDataType::Shape(rect), *transform);
|
||||
layer.overlay = true;
|
||||
self.set_layer(path, layer, -1)?;
|
||||
Some(vec![DocumentResponse::DocumentChanged, DocumentResponse::CreatedLayer { path: path.clone() }])
|
||||
}
|
||||
Operation::AddShape {
|
||||
path,
|
||||
|
||||
Reference in New Issue
Block a user