Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge PR #8030: Layers panel: a group's layers indent past the group (#8017)

aiongg5f67e5da81d7
diff --cc crates/ui-egui/src/panels.rs
index 14495493b,5bc3e4eb9..7160724be
--- a/crates/ui-egui/src/panels.rs
+++ b/crates/ui-egui/src/panels.rs
@@@ -3252,9 -3071,13 +3254,13 @@@ fn layer_row
+ if l.is_group() { crate::layer_tree_ui::TRIANGLE_W } else { 0.0 }
+ if l.clipped { 12.0 } else { 0.0 }
+ crate::layer_row_ui::reserved_width(l);
- let ts = crate::mask_thumbs_ui::thumb_size(l, if t.pro { 24.0 } else { 34.0 }, rect.width() - others);
- let fixed = others + ts + 6.0 + crate::mask_thumbs_ui::width(l, ts);
+ let ts = if base == 0.0 { 0.0 } else { crate::mask_thumbs_ui::thumb_size(l, base, rect.width() - others) };
+ let fixed = others + if ts == 0.0 { 0.0 } else { ts + 6.0 + crate::mask_thumbs_ui::width(l, ts) };
- x += 28.0 + crate::layer_row_ui::indent(depth, rect.width(), fixed);
+ // A layer inside a group (or an artboard) indents one step more than its depth, past the
+ // triangle's column, so it sits right of its parent: with only its depth its thumbnail lined
+ // up under the group's, hiding the hierarchy. Top-level rows don't move.
+ let steps = if !l.is_group() && depth > 0 { depth + 1 } else { depth };
+ x += 28.0 + crate::layer_row_ui::indent(steps, rect.width(), fixed);
let toggled = crate::layer_tree_ui::disclosure(ui, rect, &mut x, l, actions);
if l.clipped {
paint_clipping_indicator(&painter, pos2(x, rect.center().y), t.text_faint);