Skip to content

Simplify layer structure hierarchy plumbing #3742

@Keavon

Description

@Keavon

See fn serialize_structure and fn serialize_root:

https://github.com/GraphiteEditor/Graphite/blob/master/editor/src/messages/portfolio/document/document_message_handler.rs#L1894-L1958

They implement an over-engineered encoding of the hierarchical depths of a list of layers.

And see function newUpdateDocumentLayerStructure:

https://github.com/GraphiteEditor/Graphite/blob/master/frontend/src/components/panels/Layers.svelte#L138-L190

It implements the decoding of that over-engineered encoding into a JS format.

We want to replace this complexity with a much simpler flat structure of structs that become JS objects using the same way this happens with all our other data types sent from Rust to JS (via serde and messages.ts).

Instead of encoding things "cleverly" using a custom schema documented in that verbose comment in the first code snippet link, where negative signs correspond to hierarchy level shifting and such-and-such, it should just use the simplest form that directly describes the same concept but without the bit fiddling and custom schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Short-Term

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions