mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 15:18:12 +08:00
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:
co-authored by
Moritz Vetter
parent
7910395191
commit
dae79caf15
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user