From 49258624fcfabeb90a9ec4fc96fe1d79c1f2ad5b Mon Sep 17 00:00:00 2001 From: aiongg Date: Mon, 16 Nov 2026 16:13:59 +0000 Subject: [PATCH] Inspector and Text Styles panels take no padding of their own: the dock group insets them --- crates/text/src/ui/style_panel.rs | 5 +++-- crates/ui-patterns/src/patterns/panels/inspector.rs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/text/src/ui/style_panel.rs b/crates/text/src/ui/style_panel.rs index a4748ac7e..2c58e332a 100644 --- a/crates/text/src/ui/style_panel.rs +++ b/crates/text/src/ui/style_panel.rs @@ -7,7 +7,7 @@ use craft_behavior::{IconId, Selection, keyed}; use craft_theme::variant::Tone; use craft_ui::bars::StatusMessage; use craft_ui::contract::{ - ActivateOn, Bind, CollectionEvent, CommandSet, Commands as _, ListDrag, NoValue, Outcome, Props as _, Remember as _, SelectMode, + ActivateOn, Bind, CollectionEvent, CommandSet, Commands as _, ListDrag, NoValue, Outcome, Pad, Props as _, Remember as _, SelectMode, ShowCollection as _, ShowContainer as _, }; use craft_ui::list::{List, ListRow, RowInk}; @@ -231,6 +231,7 @@ const START_ACTIONS: usize = 2; /// else itself. /// - Footer: Clear Override and Redefine at the start edge; Style Options, Duplicate, New and Delete at the end edge, /// each disabled while its condition doesn't hold. The panel menu ([`TextStylesPanel::panel_rows`]) has the same commands under the same conditions. +/// - Padding: none of its own. The panel is a dock body, docked or floating, and the dock group insets it. #[must_use = "show the panel with `show`"] #[derive(craft_ui::contract::Pattern, craft_ui::contract::Props)] pub struct TextStylesPanel<'a> { @@ -354,7 +355,7 @@ impl<'a> TextStylesPanel<'a> { } }; - let shown = Panel::new(label.clone()).collection_body().command_scope(TextStyleCommand::SCOPE).footer(footer).show(ui, |ui, cx| { + let shown = Panel::new(label.clone()).pad(Pad::None).collection_body().command_scope(TextStyleCommand::SCOPE).footer(footer).show(ui, |ui, cx| { let before = cx.memory::().clone(); while let Some((command, _)) = cx.take_command::() { if let Some(found) = before.action(command) { diff --git a/crates/ui-patterns/src/patterns/panels/inspector.rs b/crates/ui-patterns/src/patterns/panels/inspector.rs index 8f7d854f5..7569ed359 100644 --- a/crates/ui-patterns/src/patterns/panels/inspector.rs +++ b/crates/ui-patterns/src/patterns/panels/inspector.rs @@ -1,7 +1,7 @@ //! `Inspector` (24.4): the properties of one target in a `Panel`, with the target's icon, name and kind in the header. use super::words::PanelWords; -use crate::contract::{BodyCx, LabelScheme, Props as _, Show as _, ShowContainer as _}; +use crate::contract::{BodyCx, LabelScheme, Pad, Props as _, Show as _, ShowContainer as _}; use crate::notices::{Notice, NoticeLayout}; use crate::primitives::IconSpec; use crate::runtime::env::{Env, Label}; @@ -21,6 +21,7 @@ mod stories; /// a change of target. /// - No target: the body is replaced by a centred notice, `empty` or "No properties", and the header shows the label. /// - The body can hold a `SectionStack` for sections the user reorders. +/// - Padding: none of its own. An inspector is a dock body, docked or floating, and the dock group insets it. #[derive(crate::contract::Pattern)] pub struct Inspector<'a> { label: Label, @@ -93,7 +94,7 @@ impl<'a> Inspector<'a> { let Inspector { label, target, icon, name, kind, empty, actions, menu } = self; let shown = target.is_some(); let title = if shown { name.unwrap_or(label) } else { label }; - let mut panel = Panel::new(title).titled().actions(actions).labels(LabelScheme::Inspector); + let mut panel = Panel::new(title).titled().actions(actions).labels(LabelScheme::Inspector).pad(Pad::None); if shown { if let Some(icon) = icon { panel = panel.icon(icon);