mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 04:04:25 +00:00
Inspector and Text Styles panels take no padding of their own: the dock group insets them
This commit is contained in:
@@ -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::<Facts>().clone();
|
||||
while let Some((command, _)) = cx.take_command::<TextStyleCommand>() {
|
||||
if let Some(found) = before.action(command) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user