From 8144714f307ebc018f24c8dfb5b68487ced7e1eb Mon Sep 17 00:00:00 2001 From: AskaEth Date: Fri, 13 Nov 2026 14:56:20 +0800 Subject: [PATCH] =?UTF-8?q?docs(ui):=20M299=20=E8=A1=A5=E4=B8=89=E5=A4=84?= =?UTF-8?q?=E4=B8=8E=E8=A1=8C=E4=B8=BA=E5=AF=B9=E9=BD=90=E7=9A=84=E6=96=87?= =?UTF-8?q?=E6=A1=A3=EF=BC=88chip=20=E9=80=89=E4=B8=AD=E6=94=AF=E3=80=81ta?= =?UTF-8?q?bs=20=E7=8A=B6=E6=80=81=E5=B1=82=E3=80=81=E5=88=86=E7=BB=84?= =?UTF-8?q?=E5=AF=BC=E8=88=AA=E7=9A=84=E5=8D=8A=E5=BE=84=E5=AE=9E=E6=B5=8B?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 只改注释,零行为变化:cargo test -p unlucky-app-iced --all-targets 全绿(1040 + 6)。 --- crates/app-iced/src/components/navigation/tabs.rs | 5 +++++ crates/app-iced/src/components/selection/paint/chip.rs | 4 ++++ crates/app-iced/src/pages/settings/frame.rs | 10 +++++++--- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/crates/app-iced/src/components/navigation/tabs.rs b/crates/app-iced/src/components/navigation/tabs.rs index 0dfe35c..9c0aa16 100644 --- a/crates/app-iced/src/components/navigation/tabs.rs +++ b/crates/app-iced/src/components/navigation/tabs.rs @@ -215,6 +215,11 @@ fn secondary_line_color(ui: &Ui) -> Color { } /// 一行标签页(自带横向滚动)。 +/// ## 状态层画在哪儿(M299) +/// +/// tab 容器**没有**选中实底(选中的标记是下方那条指示条),所以选中与未选中都一样:状态层叠在 +/// `base` 上(`Tabs::base(..)`,默认画布)。M299 之前这一层是在样式闭包**外**算的,真实 +/// hover / pressed 一个像素都不变;现在由 [`tab_fill`] 在闭包里跟 `button::Status` 求值。 pub fn tabs<'a, M: Clone + 'a>(ui: &'a Ui, tabs: Tabs<'a, M>) -> Element<'a, M> { let geometry = TabsGeometry::of(ui); let primary = tabs.variant.is_primary(); diff --git a/crates/app-iced/src/components/selection/paint/chip.rs b/crates/app-iced/src/components/selection/paint/chip.rs index 83949a7..a7bba1c 100644 --- a/crates/app-iced/src/components/selection/paint/chip.rs +++ b/crates/app-iced/src/components/selection/paint/chip.rs @@ -22,6 +22,10 @@ pub enum ChipVariant { /// /// 与 Checkbox/Radio 的区别:Chip 的**状态层就是它自己的容器**(M3 的 chip 没有圆形状态层), /// 所以未选中 + hover 的 fill 是「状态层叠在 surface 上」的实色。 +/// +/// **选中也一样吃状态层**(M299):底是实色 `SecondaryContainer`,hover / pressed 叠在它上面 +/// ——走 [`interaction::selected_fill`] 那个唯一入口。M299 之前这一支写死实色,`state` 参数 +/// 在选中分支里根本没用上(gallery 的 `chip·filter·on` 一行三态逐像素相同)。 pub fn chip( ui: &Ui, base: Base, diff --git a/crates/app-iced/src/pages/settings/frame.rs b/crates/app-iced/src/pages/settings/frame.rs index 4e935e2..3c8a9ad 100644 --- a/crates/app-iced/src/pages/settings/frame.rs +++ b/crates/app-iced/src/pages/settings/frame.rs @@ -104,9 +104,13 @@ pub(super) fn group_nav<'a>( /// /// ## 几何没动(M283 定稿的那套形状语汇) /// -/// 高 = `LM.row_height`、圆角 = [`ShapeScale::Full`](实量半径 = 高/2,就是胶囊),宽 = 列宽, -/// 内边距 `Space::X3`。本 mission 只换**颜色入口**:选中支走 [`interaction::selected_fill`], -/// 未选中支走 [`interaction::layer_color`](叠在侧列自己的卡底 `frame::BASE` 上)。 +/// 高 = `LM.row_height`、圆角 = [`ShapeScale::Full`]、宽 = 列宽,内边距 `Space::X3`。**胶囊是量出来 +/// 的,不是猜的**:从取证图 `DevDocs/artifacts/m299/new/settings-general-light-hover.png` 量到的 +/// 选中项底色 bbox 是 y240-283(高 **44**)、x120-343,且顶边下 1px 处的横向内缩是 **15px** +/// ——半径 22 的胶囊在这个位置的内缩是 r−√(r²−(r−1)²)=15.4,半径 8 的圆角只有 4.1。所以 +/// **半径 = 高/2 = 22,已经是胶囊**,本 mission 只换颜色入口:选中支走 +/// [`interaction::selected_fill`],未选中支走 [`interaction::layer_color`](叠在侧列自己的卡底 +/// `frame::BASE` 上)。 /// /// ## 内容色为什么还是静态的 ///