mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 04:18:12 +08:00
Populate layer entry cache (#437)
* Populate layer entry cache * Serialize the DocumentMessageHandler * Fix restoring of collapsed/expanded state, add iter impl for Layer, and clean up layer_data() functions * Fixed bug with CreateEmptyLayer revealed by test Co-authored-by: Keavon Chambers <keavon@keavon.com> Co-authored-by: otdavies <oliver@psyfer.io>
This commit is contained in:
co-authored by
Keavon Chambers
otdavies
parent
612732fa67
commit
82e63ea167
@@ -34,10 +34,6 @@ impl Default for Document {
|
||||
}
|
||||
|
||||
impl Document {
|
||||
pub fn with_content(serialized_content: &str) -> Result<Self, DocumentError> {
|
||||
serde_json::from_str(serialized_content).map_err(|e| DocumentError::InvalidFile(e.to_string()))
|
||||
}
|
||||
|
||||
/// Wrapper around render, that returns the whole document as a Response.
|
||||
pub fn render_root(&mut self, mode: ViewMode) -> String {
|
||||
self.root.render(&mut vec![], mode);
|
||||
@@ -48,12 +44,6 @@ impl Document {
|
||||
self.state_identifier.finish()
|
||||
}
|
||||
|
||||
pub fn serialize_document(&self) -> String {
|
||||
let val = serde_json::to_string(self);
|
||||
// We fully expect the serialization to succeed
|
||||
val.unwrap()
|
||||
}
|
||||
|
||||
/// Checks whether each layer under `path` intersects with the provided `quad` and adds all intersection layers as paths to `intersections`.
|
||||
pub fn intersects_quad(&self, quad: Quad, path: &mut Vec<LayerId>, intersections: &mut Vec<Vec<LayerId>>) {
|
||||
self.layer(path).unwrap().intersects_quad(quad, path, intersections);
|
||||
|
||||
Reference in New Issue
Block a user