Files
Unlucky-Launcher/crates/app-iced/src/components/selection/mod.rs
T
AskaEth da1fe3aa4f fix(app-iced): 盒 ≠ RENDER_PX 的图标改走 view_at,线宽回到 1.5px(M86 r1 P2)
r1 视觉/代码复审撞上同一件事:本轮把按钮/chip/switch 的盒子改成 18/18/16,但 SVG 仍按 24
烘焙、靠布局盒缩下去 ⇒ 实测线宽 1.04~1.25px(令牌要 1.5px)。label 的对照证据是同屏 caption
(20px,走了 view_at)实测正好 1.50px——差别只在有没有走按盒烘焙。

- buttons/assemble.rs(前置/后置)、selection/chip.rs(前置/后置)、selection/switch.rs 滑块勾
  共 5 处改为 icons::view_at(kind, color, geometry.icon);
- 新增单测 view_at_bakes_the_requested_size:source(18) 必须是 width=18 + stroke-width=2.0
  (视觉 1.5px),并反证「24 烘焙塞进 18 盒只有 1.125px」;
- 新增源码级守门 sub_24_boxes_go_through_view_at:icons::view 只允许出现在图标盒=24 的文件,
  否则红——谁把上面 5 处改回 view 立刻被抓;
- 三处会带偏人的文字订正:icons.rs 模块文档改成「24 盒走 view、其余一律 view_at」;
  selection/mod.rs 的「图标一律 icons::view」同改;token_contract.rs 明说那条只保证烘焙路径。
2026-11-02 13:12:14 +08:00

51 lines
2.1 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! **选择类家族**(D39 §1 的 ownership 切片):Checkbox / Radio / Switch / Chip。
//!
//! | 组件 | 参考章节 | 尺寸一句话 |
//! |---|---|---|
//! | [`Checkbox`] | `research/15` §18 | 20×20 / 圆角 2 / 描边 2(向内收)/ 勾 12dp 方头 / Ø40 状态层 / 命中 48 |
//! | [`Radio`] | `research/15` §19 | 外圈 20 / 环线 2 / 内点 **10**(不是 12)/ Ø40 状态层 |
//! | [`Switch`] | `research/12b` §10 | 轨道 52×32 / 滑块 24·16 / Ø40 状态层 |
//! | [`Chip`] | `research/12b` §13 | 高 32 / 圆角 8 / 内边距 8 / Assist·Filter·Input |
//!
//! ## 分层(照抄按钮家族,审起来只需看四处)
//!
//! ```text
//! geometry.rs 令牌 → 像素(唯一把 ComponentMetrics / Space / ShapeScale 读成数字的地方)
//! paint.rs Interaction × 选中 × 错误 → 角色 → 颜色(唯一写角色名的地方)
//! shell.rs button 四态 → 内部自绘样式的帧内通道 + 勾形 SVG
//! <component>.rs 布局与装配(一行一个 Element)
//! ```
//!
//! ## 纪律(D39 契约 §2 / §3)
//!
//! - 全部组件**对消息类型泛型**(`M: Clone`),不 import `crate::app::Message`;
//! - hover / pressed / focus / disabled 的 α 只从 [`super::interaction`] 取(本目录零 α 字面量);
//! - 精确尺寸只从 [`super::layout`](`centered_fixed` / `fixed`)与 `geometry` 取,不许手写;
//! - 图标一律 `icons::view_at(kind, color, geometry.icon)` + 固定尺寸容器(Q9):本目录的盒是
//! **18(chip)与 16(switch 滑块)**,都不是 `icons::RENDER_PX`(24),所以必须按盒烘焙——用
//! `icons::view`(24 烘焙)会被布局缩到 1.1px 视觉线宽(复审 r1 P2-2)。圆角按 D32 分层
//! (微控件 2 / 容器刻度 / full)。
mod checkbox;
mod chip;
mod radio;
mod shell;
mod switch;
pub mod geometry;
pub mod matrix;
pub mod paint;
#[cfg(test)]
mod pixel;
#[cfg(test)]
mod probe;
#[cfg(test)]
mod tests;
pub use checkbox::{checkbox, CheckValue, Checkbox};
pub use chip::{chip, Chip};
pub use paint::ChipVariant;
pub use radio::{radio, Radio};
pub use switch::{switch, Switch};