docs(app-iced): M75 r3c —— interaction.rs 文档收口(Tracker 用法/α 表压行,回到 400 行内)

This commit is contained in:
AskaEth committed 2026-11-02 04:50:57 +08:00
1 parent 86f7a31d9a
commit a3b3c9eba7
1 file changed
+6 -11
+6 -11
View File
@@ -109,10 +109,10 @@ pub fn overlay_color(ui: &Ui, state: Interaction, content: Role, container: Role
.map(|layer| ui.state_over(layer, content, container)) .map(|layer| ui.state_over(layer, content, container))
} }
/// 禁用态内容色:`OnSurface` @ 38% 叠在 **`base` 角色**上(不经过 12% 容器)。 /// 禁用态内容色:`OnSurfaceVariant` @ 38% 叠在 **`base` 角色**上(不经过 12% 容器)。
/// ///
/// 给**不画容器**的三式(Text / Outlined / standard IconButton)用:它们的禁用内容直接落在 /// 给**不画容器**的三式(Text / Outlined / standard IconButton)用:错用 [`disabled_colors`]
/// surface 上,若错用 [`disabled_colors`] 的内容值(叠在 12% 容器上),会比令牌口径深 21/255。 /// 的内容值(叠在 12% 容器上)会比令牌口径深 21/255。
pub fn disabled_content_over(ui: &Ui, base: Role) -> Color { pub fn disabled_content_over(ui: &Ui, base: Role) -> Color {
let scheme = Scheme::baseline(ui.flavor()); let scheme = Scheme::baseline(ui.flavor());
// A1(AAR `FilledButtonTokens` javap):DisabledLabelTextColor/DisabledIconColor 都是 // A1(AAR `FilledButtonTokens` javap):DisabledLabelTextColor/DisabledIconColor 都是
@@ -154,14 +154,9 @@ pub fn disabled_colors(ui: &Ui, surface: Role) -> (Color, Color) {
/// 自定义 `Widget` 的状态机:把 iced 事件折成 [`Interaction`]。 /// 自定义 `Widget` 的状态机:把 iced 事件折成 [`Interaction`]。
/// ///
/// 这是 D39 §3 说的「状态机的公共部分」。用法(自定义 Widget 的 `update` 里): /// D39 §3 说的「状态机的公共部分」。自定义 `Widget` 的 `update` 里:
/// /// `if tracker.event(event, cursor.is_over(bounds)) { shell.request_redraw(); }`,
/// ```ignore /// 画的时候读 `tracker.state()`。`event()` 只在**视觉态真的变了**时返回 `true`。
/// if self.tracker.event(event, cursor.is_over(layout.bounds())) {
/// shell.request_redraw(); // 只有真变了才重绘
/// }
/// let style = style_of(self.tracker.state());
/// ```
// 本 mission 的按钮家族全部走 iced 的 `button`,没有自绘控件,所以 Tracker 目前只有单测在用; // 本 mission 的按钮家族全部走 iced 的 `button`,没有自绘控件,所以 Tracker 目前只有单测在用;
// 它在这里是给四个后续家族(Slider / Switch 轨道这类要自绘的)准备的公共状态机。 // 它在这里是给四个后续家族(Slider / Switch 轨道这类要自绘的)准备的公共状态机。
#[allow(dead_code)] #[allow(dead_code)]