Files
Unlucky-Launcher/crates/app-iced/src/components/selection/mod.rs
T
AskaEth 4155429f45 test(selection): 像素判据从「存在性」改成「逐处都对」(复审 P2-4)
- 20(±1) 的 Primary 块:**每一块**都不许超过 21(22 = 描边画到框外),且总数恰好 12
- 状态层:**每一块** Ø40 都要四角无墨(原来只看两块角点),数量 ≥5
- switch 轨道 **恰好一块** 52×32、chip **恰好一块** 32 高(原来 any(...) 就算过)
- 新增 P2-1 / P2-3 的像素断言:禁用 chip 4 块完整宽度 + filter·on 仍填充;20×20 禁用块不许是 12%
- 断言与像素扫描搬到 selection/probe.rs + selection/pixel.rs:gallery/selection.rs 只剩「摆矩阵」
  (原文件 458 行,超 400 红线)
2026-11-02 06:55:34 +08:00

48 lines
1.9 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` + 固定尺寸容器(Q9),圆角按 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};