docs: explain console, network and settings view projections

This commit is contained in:
2026-11-12 19:12:50 +08:00
parent 50571e156e
commit bb6e78ad04
3 changed files with 47 additions and 0 deletions
+5
View File
@@ -4,7 +4,9 @@
use super::*;
/// 绘制强调色候选、自定义颜色编辑框及主题预览;实际应用和错误校验由输入动作处理。
// developer_tools::build 选择 Settings 时调用,产生工具控件和 Action;颜色解析与主题应用由输入处理路径完成。
pub(super) fn build(p: &mut Painter, state: &mut DeveloperToolsState, viewport: Rect) {
// 强调色、编辑框和预览使用同一工具坐标原点,宽度来自宿主分配,不读取业务 Page 布局。
let x = viewport.x;
let w = viewport.width;
@@ -18,6 +20,7 @@ pub(super) fn build(p: &mut Painter, state: &mut DeveloperToolsState, viewport:
);
// 色块动作携带调色板索引,绘制仅比较当前 accent 标记选中;实际修改由统一动作处理器执行。
for (i, color) in PALETTE.iter().enumerate() {
// 每个调色板项固定宽度和间距,索引 i 作为 Action::Theme 的参数与 PALETTE 一一对应。
let r = Rect::new(x + 24.0 + i as f32 * 44.0, 122.0, 32.0, 32.0);
p.ui.swatch(r, Action::Theme(i), *color, *color == state.accent);
}
@@ -41,6 +44,7 @@ pub(super) fn build(p: &mut Painter, state: &mut DeveloperToolsState, viewport:
&format!(
"{}{}",
state.custom,
// 尾部竖线只提示焦点,state.custom 仍是未提交编辑值,不能因显示该值就认为主题已更新。
if state.focus == Some(Focus::Custom) {
"│"
} else {
@@ -52,6 +56,7 @@ pub(super) fn build(p: &mut Painter, state: &mut DeveloperToolsState, viewport:
);
// 校验错误由输入处理路径写入,设置页只显示;错误不会在每次重绘时重复执行或清除。
// 只有已有错误才画错误行,不在 build 中重新校验或清除,保留用户提交操作的反馈。
if !state.input_error.is_empty() {
p.label(x + 24.0, 245.0, &state.input_error, ERROR, false);
}