mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 02:58:13 +08:00
Fixed most crashes
This commit is contained in:
@@ -140,6 +140,10 @@ impl Document {
|
||||
path
|
||||
}
|
||||
|
||||
pub fn is_folder(&self, path: &[LayerId]) -> bool {
|
||||
return self.folder(path).is_ok();
|
||||
}
|
||||
|
||||
// Determines which layer is closer to the root, if path_a return true, if path_b return false
|
||||
// Answers the question: Is A closer to the root than B?
|
||||
pub fn layer_closer_to_root(&self, path_a: &[u64], path_b: &[u64]) -> bool {
|
||||
|
||||
@@ -101,6 +101,11 @@ impl Folder {
|
||||
Some(&mut self.layers[pos])
|
||||
}
|
||||
|
||||
pub fn folder_contains(&self, id: LayerId) -> bool {
|
||||
log::debug!("For {:?} Folder does contain {:?}", id, self.layer_ids.contains(&id));
|
||||
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_else(|| DocumentError::LayerNotFound([layer_id].into()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user