mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 09:38:11 +08:00
Change layer duplication so the duplicate is placed above the original (#1124)
Previously, the duplicated layer would be placed at the top of the stack. It is now inserted one layer above the original. --------- Co-authored-by: Ollie Dolan <olliedolan10@gmail.com> Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
co-authored by
Ollie Dolan
Keavon Chambers
parent
4c9ef0fe6c
commit
b83f2c24f1
@@ -718,7 +718,11 @@ impl Document {
|
||||
let layer = self.layer(&path)?.clone();
|
||||
let (folder_path, _) = split_path(path.as_slice()).unwrap_or((&[], 0));
|
||||
let folder = self.folder_mut(folder_path)?;
|
||||
if let Some(new_layer_id) = folder.add_layer(layer, None, -1) {
|
||||
|
||||
let selected_id = path.last().copied().unwrap_or_default();
|
||||
let insert_index = folder.layer_ids.iter().position(|&id| id == selected_id).unwrap_or(0) as isize + 1;
|
||||
|
||||
if let Some(new_layer_id) = folder.add_layer(layer, None, insert_index) {
|
||||
let new_path = [folder_path, &[new_layer_id]].concat();
|
||||
self.mark_as_dirty(folder_path)?;
|
||||
Some(
|
||||
|
||||
Reference in New Issue
Block a user