From cf928885f892199ca7559255339ecfb03facdff2 Mon Sep 17 00:00:00 2001 From: aiongg Date: Thu, 12 Nov 2026 15:46:06 +0000 Subject: [PATCH] Layers: the row's effects badge is the fx icon A list row paints a trailing drag handle's icon face as a mark, not an icon button: a handle has no node of its own (the row's description names it), and a button face would add an unnamed button. --- crates/layers/src/ui/panel/mod.rs | 1 - crates/layers/src/ui/panel/row.rs | 2 +- crates/ui-widgets/src/list/row/paint.rs | 8 ++++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/layers/src/ui/panel/mod.rs b/crates/layers/src/ui/panel/mod.rs index 899f4da05..2e51583a9 100644 --- a/crates/layers/src/ui/panel/mod.rs +++ b/crates/layers/src/ui/panel/mod.rs @@ -80,7 +80,6 @@ craft_ui::words! { linked: "layersPanel.linked" = "linked"; layer_mask: "layersPanel.layerMask" = "layer mask"; vector_mask: "layersPanel.vectorMask" = "vector mask"; - fx: "layersPanel.fx" = "fx"; disabled_mask: "layersPanel.disabledMask" = "disabled mask"; has_effects: "layersPanel.hasEffects" = "effects"; has_smart_filters: "layersPanel.hasSmartFilters" = "Smart Filters"; diff --git a/crates/layers/src/ui/panel/row.rs b/crates/layers/src/ui/panel/row.rs index 074093e6a..3298abc9d 100644 --- a/crates/layers/src/ui/panel/row.rs +++ b/crates/layers/src/ui/panel/row.rs @@ -321,7 +321,7 @@ fn layer_row<'r, T: LayerTree>(cx: &'r PanelContext<'r, T>, id: &T::Id) -> ListR // The badge drags every effect of the layer (Photoshop); a click on it is a click on the row. let badge = TrailingPart::new(FX_BADGE); row = row - .trailing_part(badge, TrailingFace::Strong(words.fx.clone()), words.has_effects.clone()) + .trailing_part(badge, TrailingFace::Icon(IconSpec::svg(IconId::new("fx"))), words.has_effects.clone()) .part_drag(RowDragSpot::Trailing(badge), LayersDrag::new(cx.list, vec![LayerRowKey::Effects(id.clone(), None)])); } if info.linked { diff --git a/crates/ui-widgets/src/list/row/paint.rs b/crates/ui-widgets/src/list/row/paint.rs index 3bdd6a55f..1722081f0 100644 --- a/crates/ui-widgets/src/list/row/paint.rs +++ b/crates/ui-widgets/src/list/row/paint.rs @@ -21,6 +21,8 @@ impl ListRow<'_> { pub(super) fn paint_trailing(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>, placed: &Placed) { let side = Vec2::splat(cx.style.sizes.icon); let selected = cx.resolved.selected == Some(true) || cx.env.facts_of(cx.id).is_some_and(|facts| facts.flags.contains(Flags::SELECTED)); + let drags = &self.drags; + let handle = |part: &super::TrailingPart| drags.iter().any(|(spot, _)| *spot == super::RowDragSpot::Trailing(*part)); for (at, (trailing, slot)) in self.trailing.iter_mut().zip(&placed.items).enumerate() { let Some(slot) = slot else { continue }; let shape = Rect::from_center_size(slot.center(), side); @@ -51,6 +53,12 @@ impl ListRow<'_> { continue; } match face { + // A drag handle is no button (`access` names it in the row's description): its icon is a mark. + TrailingFace::Icon(icon) if handle(part) => { + let mut icon = icon.clone(); + icon.color.get_or_insert(cx.resolve(&cx.style.trailing_icon.color)); + ui.draw().icon(shape, &icon); + } TrailingFace::Icon(icon) => ui.face(key, IconButton::new(icon.clone()).focusable(false).enabled(*enabled)), TrailingFace::Disclosure { open } => ui.face(key, Disclosure::new(Bind::given(*open)).node(false).enabled(*enabled)), TrailingFace::Strong(text) => {