Files
craft-libs/crates/layers
dotCooCoo 6aabced7c1 perf(layers): keep the display order through edits that leave the tree's structure as it was
The Layers panel keyed its display order by the tree's tracked revision,
which every edit moves, so a selection change in an expanded tree walked
every layer again: 10,002 children() calls for a 10,000-layer document.

LayerTree::order_revision lets the app report a number that changes only
when children, open groups, open effects or sub-row counts change. With
it, the panel keeps the display order until that number, the tracked
source, the filter or a reveal's opens change. While the filter is
active the order still follows the tracked revision, since the filter
reads what the rows show. Trees that report no order revision behave as
before.

Trials count the display order builds: a selection change builds none,
a new order revision builds one, an edit under an active filter builds
one, and another tree with the same order revision builds its own rows.
2026-11-29 11:23:42 -08:00
..
2026-11-19 09:25:07 +01:00
2026-11-14 17:56:01 +00:00

craft-layers

The Layers panel for Craft apps. The app implements LayerTree, a read-only view of its layers; LayersPanel shows it and reports what the user did as events in the order they happened. The app applies them with its own commands and undo.

Module (craft_layers::ui::…) What it gives the app
tree LayerTree, the one trait an app implements: children and parent, one LayerInfo per row (name, kind, visibility, label colour, locks, clipping, link, blend label, masks, effects, smart object source, warning), the selection and target, sub-rows, the active layer's properties, the blend modes (Entry<String> lists), the footer's state and the drop rules.
panel LayersPanel: the filter bar, the blend and opacity row, the lock and fill row, the rows, the footer; one focus stop, keyboard, rename in place (double-click on the name, F2 or start_rename), drag and drop, AccessKit. LayersEvents out; panel_menu and run_command for the panel menu; LayersPanel::style(&UiTokens) gives the look.
rows BlendRows: Blend mode, Opacity, Lock and Fill as one block, usable alone (a Properties panel).
comps LayerCompsPanel over the app's comp rows, reporting LayerCompsEvents.
filter LayerFilter and LayerFilterBar: filter by kind, name, effect, blend mode, attribute, label colour, smart object, artboard or group; the matching rule is plain code, and LayerTree::listed lets the app answer what only it knows (missing linked files, empty layers).
options LayersSettings (the persisted section), LayersOptions and LayersOptionsDialog (Layers Panel Options: thumbnail size and contents, the five switches).
thumbs LayerThumb, LayerThumbKind, ThumbContents: the key the panel gives craft_ui::primitives::textures::Thumbnails for each thumbnail of a row; the app implements ThumbSource for it.

Its words are the words! structs of the parts: LayersPanelWords, BlendRowsWords, LayerCompsWords, LayerFilterWords and LayersOptionsWords.

The crate is UI-only: egui and craft-ui are plain dependencies, and screen-testing is its only feature.