Implement layer renaming (#501)

* Implement layer renaming

* Fix sneaky typo in CSS

Co-authored-by: Moritz Vetter <16950410+HansAuger@users.noreply.github.com>

Co-authored-by: Moritz Vetter <16950410+HansAuger@users.noreply.github.com>
This commit is contained in:
Keavon Chambers
2022-01-29 11:04:15 -08:00
co-authored by Moritz Vetter
parent 7910395191
commit dae79caf15
11 changed files with 144 additions and 42 deletions
+7
View File
@@ -641,6 +641,13 @@ impl Document {
layer.visible = *visible;
Some([vec![DocumentChanged], update_thumbnails_upstream(path)].concat())
}
Operation::SetLayerName { path, name } => {
self.mark_as_dirty(path)?;
let mut layer = self.layer_mut(path)?;
layer.name = if name.as_str() == "" { None } else { Some(name.clone()) };
Some(vec![LayerChanged { path: path.clone() }])
}
Operation::SetLayerBlendMode { path, blend_mode } => {
self.mark_as_dirty(path)?;
self.layer_mut(path)?.blend_mode = *blend_mode;
+5
View File
@@ -10,6 +10,7 @@ use std::hash::{Hash, Hasher};
#[repr(C)]
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
// TODO: Rename all instances of `path` to `layer_path`
pub enum Operation {
AddEllipse {
path: Vec<LayerId>,
@@ -124,6 +125,10 @@ pub enum Operation {
path: Vec<LayerId>,
visible: bool,
},
SetLayerName {
path: Vec<LayerId>,
name: String,
},
SetLayerBlendMode {
path: Vec<LayerId>,
blend_mode: BlendMode,