Fix group creation parenting (#455)

* WIP fix of folder crash / indent

* Fixed most crashes

* Known cases of crash / incorrect behavior resolved

* Removed todo & readability tweak

* Removed left over test

* Resolved clippy issue resulting from merging master

* Replace recursive tree traversal with prefix matching

* Reverted changes for #453 and added undo functionality to Paste

* Make uuid generator thread local for tests

* Maintain layer order, test still failing 50% of the time

* Reverting back to known working with the knowledge we can optimize later.

This reverts commit 1aaf5c0d7d.

* Revert "Make uuid generator thread local for tests"

This reverts commit d68e3b9c4e.

* Revert "Reverted changes for #453 and added undo functionality to Paste"

This reverts commit d66992ac94.

* Revert "Replace recursive tree traversal with prefix matching"

This reverts commit 6bcbb9f82f.

* Reverted to working state and added comment back to optimized commit hash

* Re-removed the changes involving #453

Co-authored-by: Dennis <dennis@kobert.dev>
This commit is contained in:
Oliver Davies
2022-01-04 19:18:28 -08:00
committed by Keavon Chambers
co-authored by Dennis
parent 26f0f70023
commit 70d3283196
5 changed files with 77 additions and 30 deletions
+5 -1
View File
@@ -101,8 +101,12 @@ impl Folder {
Some(&mut self.layers[pos])
}
pub fn folder_contains(&self, id: LayerId) -> bool {
self.layer_ids.contains(&id)
}
pub fn position_of_layer(&self, layer_id: LayerId) -> Result<usize, DocumentError> {
self.layer_ids.iter().position(|x| *x == layer_id).ok_or(DocumentError::LayerNotFound)
self.layer_ids.iter().position(|x| *x == layer_id).ok_or_else(|| DocumentError::LayerNotFound([layer_id].into()))
}
pub fn folder(&self, id: LayerId) -> Option<&Folder> {