mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Place new layers in tree based on layer selection (#526)
* place new layers based on layer selection
This commit is contained in:
@@ -462,6 +462,16 @@ impl DocumentMessageHandler {
|
||||
self.artboard_message_handler.artboards_graphene_document.viewport_bounding_box(&[]).ok().flatten()
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the path that new layers should be inserted to.
|
||||
/// Depends on the selected layers as well as their types (Folder/Non-Folder)
|
||||
pub fn get_path_for_new_layer(&self) -> Vec<u64> {
|
||||
// If the selected layers dont actually exist, a new uuid for the
|
||||
// root folder will be returned
|
||||
let mut path = self.graphene_document.shallowest_common_folder(self.selected_layers()).map_or(vec![], |v| v.to_vec());
|
||||
path.push(generate_uuid());
|
||||
path
|
||||
}
|
||||
}
|
||||
|
||||
impl PropertyHolder for DocumentMessageHandler {
|
||||
|
||||
Reference in New Issue
Block a user