feat: add document layers#1780
Open
awerty-noob wants to merge 5 commits into
Open
Conversation
- Active indicator: CheckButton radio group (dot radio pattern from appmenu) - Up/Down: dir-up-symbolic / dir-down-symbolic with flat CSS - Delete: selection-trash-symbolic with flat CSS
- Add ordered elements field to XoppLayer for correct z-order - Import: merge xopp layers by name across pages into rnote DocumentLayers - Export: group strokes by DocumentLayer with layer names preserved - Write empty named layers to xopp for metadata preservation - Filter hidden layers from export (all formats) - Add tests for xopp layer roundtrip, merge-by-name, named/unnamed/empty layers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add document layers (similar to image editors like Photoshop/GIMP) to Rnote. Closes #1253.
Each document now has a list of layers with name, visible, locked states. Strokes belong to a layer; only the active layer is drawn/edited on by default.
Changes
Data model (crates/rnote-engine/src/store/layer_comp.rs)
DocumentLayer,DocumentLayerId,LayerComponent.StrokeStoregainslayers,layer_components,active_layer_id,layer_counter..rnotefiles without layer data are backward-compatible — all strokes default toLayer 1.Rendering order
Sorting in
chrono_comp.rsnow respects document layer order → existing StrokeLayer → chrono timestamp.Per-layer filtering
stroke_keys_as_rendered,regenerate_rendering_in_viewport_threaded).Engine API
Public methods added on
Engine:layers(),active_layer_id()set_active_layer(),add_layer(),delete_layer(),rename_layer()set_layer_visible(),set_layer_locked()move_layer_up(),move_layer_down()All layer mutations enter undo/redo history.
Xournal++ (.xopp) import/export preservation
.xopp files now preserve document layer structure on import and export:
DocumentLayers by name (merge across pages), preserving layer names and stroke-to-layer assignment.DocumentLayerproduces a named<layer>in the xopp output, with elements ordered to match rnote z-order (images below strokes). Empty named layers are written as placeholders; hidden layers are excluded.UI (crates/rnote-ui)
A new "Layers" page in the sidebar with controls to:
Layer buttons use symbolic SVG icons instead of text. Sidebar has i18n support for all layer-related labels.
Tests
Engine unit tests cover:
.rnotesnapshot preserves layer metadata (name, order, visible, locked)elementsfieldBuild verification
All targets pass:
meson compile ui-cargo-checkmeson compile cli-cargo-checkmeson test(validation tests: 3/3 OK)cargo test --workspace(18 passed, 1 ignored)meson compile cargo-fmt-check(pass)