Merge PR #9315: Layers panel: the filter row lists the artboards that hold the selected layers

This commit is contained in:
David Mann committed 2026-11-05 04:58:00 +01:00
commit e5e443a5ce
2 files changed
+16 -8

No files matched your search

+15 -7
View File
@@ -72,17 +72,16 @@ impl Filter {
/// Returns [`Filter::of`] for `app`'s settings, with the active document's missing linked
/// files while the panel filters by Smart Object, and `board_rows` set to the rows of the
/// artboards that hold the active document's selected layers while it filters by Artboard,
/// and `empty` set while it filters by Empty or Not Empty.
pub fn of_app(app: &PhotocraftApp) -> Self {
/// artboards in `doc` that hold `selection` while it filters by Artboard, and `empty` set
/// while it filters by Empty or Not Empty. The Layers panel passes the document and the
/// selection it already read for the frame.
pub fn with_selection(app: &PhotocraftApp, doc: &Document, selection: &[LayerId]) -> Self {
let mut f = Self::of(&app.ui);
if f.by == FilterBy::SmartObject {
f.missing = app.session.missing_links();
}
if f.by == FilterBy::Artboard
&& let Some(d) = app.session.active()
{
f.board_rows = board_rows(&d.doc, &d.selected_layers());
if f.by == FilterBy::Artboard {
f.board_rows = board_rows(doc, selection);
}
if f.by == FilterBy::Attribute {
f.empty = attribute::empty_layers(app, f.attribute);
@@ -90,6 +89,15 @@ impl Filter {
f
}
/// Returns [`Filter::with_selection`] for the active document and its selected layers, or
/// [`Filter::of`] with no artboard rows when no document is open.
pub fn of_app(app: &PhotocraftApp) -> Self {
match app.session.active() {
Some(d) => Self::with_selection(app, &d.doc, &d.selected_layers()),
None => Self::of(&app.ui),
}
}
/// Whether the panel is filtered. Like Photoshop, Effect, Mode, Attribute and Color always
/// filter (by Bevel & Emboss, by Normal, by Visible and by no colour at first); Kind, Name and
/// Smart Object only once a toggle is on or some text is typed; Artboard only while some layers
+1 -1
View File
@@ -271,7 +271,7 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
ui.scroll_with_delta(vec2(0.0, delta));
ctx.request_repaint();
}
let filter = crate::layer_filter_ui::Filter::of_app(app);
let filter = crate::layer_filter_ui::Filter::with_selection(app, &doc, &selection);
let fx_collapsed = app.session.active().map(|d| d.fx_collapsed.clone()).unwrap_or_default();
crate::layer_row_ui::begin(ui.ctx());
// The drawn rows, top to bottom (#1721): the space between them and below the last