fix(demo): 消除字体回退乱码与多余点缀色,清理冗余图

- 乱码根因:本机字体对「设」「置」回退到点阵字体(所有字体栈均异常),图片文案改为不含这两字(时序图工作台 / 装配线节拍方案 / 工艺参数 / 参数 / 起点 / 复位视图)
- 特殊符号改为矢量绘制,避免混排字体度量错位:撤销/重做箭头、跨循环延续箭头、面板关闭叉、参数图标
- 修正 logo 中文标题与英文副标题重叠
- 相位分区色带收敛为单色(避免 5 色点缀 + 重叠区叠色),工位负载条改单色
- 删除冗余的浅色工艺参数面板图(保留 5 张:深/浅 × 圆周/条形 + 深色参数面板)
- 文档同步:产品名、工艺参数面板、字体风险项
This commit is contained in:
2026-09-18 00:01:28 +08:00
parent b876ef2129
commit e7ffa35959
15 changed files with 71 additions and 55 deletions
+56 -37
View File
@@ -203,11 +203,22 @@ function iconAt(cx, cy, name, col) {
case 'help':
return circle(c, m, 10, { stroke: col, sw: 1.8 })
+ txt(c, m + 1, '?', { size: 13, anchor: 'middle', fill: col, weight: 700 });
case 'ruler':
return rect(c - 10, m - 6, 20, 12, { rx: 2, stroke: col, sw: 1.6 })
+ line(c - 5, m - 6, c - 5, m - 1, { stroke: col, sw: 1.4 })
+ line(c, m - 6, c, m - 2, { stroke: col, sw: 1.4 })
+ line(c + 5, m - 6, c + 5, m - 1, { stroke: col, sw: 1.4 });
case 'sliders':
return line(c - 9, m - 6, c + 9, m - 6, { stroke: col, sw: 2, cap: 'round' })
+ circle(c - 3, m - 6, 3, { fill: T.panel, stroke: col, sw: 2 })
+ line(c - 9, m, c + 9, m, { stroke: col, sw: 2, cap: 'round' })
+ circle(c + 4, m, 3, { fill: T.panel, stroke: col, sw: 2 })
+ line(c - 9, m + 6, c + 9, m + 6, { stroke: col, sw: 2, cap: 'round' })
+ circle(c - 1, m + 6, 3, { fill: T.panel, stroke: col, sw: 2 });
case 'undo':
return line(c + 9, m, c - 7, m, { stroke: col, sw: 2.4, cap: 'round' })
+ path(`M ${c - 9} ${m} l 7 -5.5 l 0 11 z`, { fill: col });
case 'redo':
return line(c - 9, m, c + 7, m, { stroke: col, sw: 2.4, cap: 'round' })
+ path(`M ${c + 9} ${m} l -7 -5.5 l 0 11 z`, { fill: col });
case 'return':
return path(`M ${c + 6} ${m - 6} L ${c + 6} ${m + 2} L ${c - 4} ${m + 2}`, { stroke: col, sw: 2, cap: 'round' })
+ path(`M ${c - 5} ${m + 2} l 5 -3.6 l 0 7.2 z`, { fill: col });
default:
return '';
}
@@ -253,7 +264,8 @@ function unitCard(x, y, w) {
const h = 158;
let s = rect(x, y, w, h, { rx: 12, fill: C.panel2, stroke: C.line, sw: 1 });
s += txt(x + 14, y + 24, '工艺单位与精度', { size: 13, fill: C.dim, ls: 2 });
s += txt(x + w - 14, y + 24, '⚙ 设置…', { size: 12.5, anchor: 'end', fill: C.accent });
s += txt(x + w - 14, y + 24, '参数', { size: 12.5, anchor: 'end', fill: C.accent });
s += iconAt(x + w - 62, y + 24, 'sliders', C.accent);
const bw = 60;
s += txt(x + 14, y + 58, '时间单位', { size: 12.5, fill: C.sub });
['ms', 's', 'min'].forEach((u, i) => { s += segBtn(x + 100 + i * (bw + 6), y + 42, bw, 32, u, u === UNIT.time); });
@@ -277,14 +289,14 @@ function chrome(mode) {
s += rect(24, 17, 30, 30, { rx: 9, fill: C.accent, opacity: 0.18 });
s += rect(24, 17, 30, 30, { rx: 9, stroke: C.accent, sw: 1.2 });
s += path(`M 32 38 L 39 26 L 46 38`, { stroke: C.accent, sw: 2, cap: 'round' });
s += txt(64, 31, '时序图设计器', { size: 17, weight: 700, ls: 1 });
s += txt(170, 33, 'Sequence Diagram Studio', { size: 11.5, fill: C.dim });
s += txt(64, 31, '时序图工作台', { size: 17, weight: 700, ls: 1 });
s += txt(202, 33, 'Sequence Diagram Studio', { size: 11.5, fill: C.dim });
s += btn(320, 68, '新建');
s += btn(394, 68, '打开');
s += btn(468, 68, '保存');
s += btn(552, 74, '撤销 ↶');
s += btn(632, 74, '重做 ↷');
s += btn(552, 74, '撤销', { iconName: 'undo' });
s += btn(632, 74, '重做', { iconName: 'redo' });
s += btn(722, 132, '添加动作', { kind: 'add', iconName: 'add', size: 14.5 });
s += btn(862, 80, '编辑', { kind: 'toggle', iconName: 'edit', size: 14.5 });
@@ -296,7 +308,7 @@ function chrome(mode) {
s += btn(1444, 106, '导出 PNG');
s += btn(1568, 96, '− 100% +');
s += btn(1672, 96, '适应窗口');
s += btn(1776, 84, '重置视图');
s += btn(1776, 84, '复位视图');
s += rect(1868, 14, 96, 36, { rx: 9, fill: C.panel, stroke: C.accent, sw: 1.2 });
s += txt(1884, 33, '单位', { size: 12.5, fill: C.dim });
@@ -366,7 +378,7 @@ function leftPanel(mode, selected) {
s += rect(16, 112, 348, 108, { rx: 12, fill: C.panel2, stroke: C.line, sw: 1 });
s += rect(32, 128, 34, 34, { rx: 9, fill: C.accent2, opacity: 0.2 });
s += txt(49, 146, '装', { size: 15, anchor: 'middle', fill: C.accent2, weight: 700 });
s += txt(78, 138, '装配线节拍设计', { size: 15.5, weight: 600 });
s += txt(78, 138, '装配线节拍方案', { size: 15.5, weight: 600 });
s += txt(78, 160, '装配线节拍.seq.json · v1.2', { size: 12, fill: C.dim });
s += txt(32, 196, `循环 ${tfmt(CYCLE_MS)} = 360° = 100%`, { size: 12.5, fill: C.accent });
s += txt(232, 196, '动作 8 · 依赖 7', { size: 12.5, fill: C.sub });
@@ -401,7 +413,7 @@ function leftPanel(mode, selected) {
s += txt(24, yb + 92, '显示选项', { size: 13, fill: C.dim, ls: 2 });
const opts = mode === 'bar'
? ['时间轴 / 相位双刻度', '依赖箭头 FS / SS', '跨循环片段标记', '相位分区色带']
? ['时间轴 / 相位双刻度', '依赖箭头 FS / SS', '跨循环片段标记', '相位分区标注']
: ['同心圆环背景', '顺序箭头(FS / SS)', '层半径标注', '跨循环高亮'];
opts.forEach((o, i) => {
const y = yb + 112 + i * 28;
@@ -412,13 +424,13 @@ function leftPanel(mode, selected) {
const yload = yb + 112 + opts.length * 28 + 34;
s += txt(24, yload, '工位负载 / 相位占用', { size: 13, fill: C.dim, ls: 2 });
const loads = [['ST1 上料 · 夹紧', 115, C.accent], ['ST2 压装 · 焊接', 215, C.warn], ['ST3 检测 · 下料', 85, C.ok]];
loads.forEach(([k, deg, col], i) => {
const loads = [['ST1 上料 · 夹紧', 115], ['ST2 压装 · 焊接', 215], ['ST3 检测 · 下料', 85]];
loads.forEach(([k, deg], i) => {
const y = yload + 26 + i * 36;
s += txt(24, y, k, { size: 12.5, fill: C.sub });
s += txt(356, y, `${deg}° · ${((deg / 3.6)).toFixed(1)}%`, { size: 12, anchor: 'end', fill: col, weight: 600 });
s += txt(356, y, `${deg}° · ${((deg / 3.6)).toFixed(1)}%`, { size: 12, anchor: 'end', fill: C.accent, weight: 600 });
s += rect(24, y + 12, 332, 8, { rx: 4, fill: T.track });
s += rect(24, y + 12, (332 * deg) / 360, 8, { rx: 4, fill: col });
s += rect(24, y + 12, (332 * deg) / 360, 8, { rx: 4, fill: C.accent });
});
const ynote = yload + 26 + 3 * 36 + 22;
s += rect(16, ynote, 348, 96, { rx: 10, fill: T.info, stroke: C.line, sw: 1 });
@@ -497,7 +509,7 @@ function rightPanelCircular() {
y += 62;
s += rect(lx, y, rx - lx, 58, { rx: 10, fill: T.info, stroke: C.line, sw: 1 });
s += txt(lx + 14, y + 22, '新增动作置于最外层;箭头方向即执行顺序', { size: 11.5, fill: C.sub });
s += txt(lx + 14, y + 22, '新增动作放在最外层;箭头方向即执行顺序', { size: 11.5, fill: C.sub });
s += txt(lx + 14, y + 40, '绿实线 FS 严格顺序 · 琥珀虚线 SS 并行重叠', { size: 11.5, fill: C.sub });
y += 78;
@@ -814,18 +826,23 @@ function barView() {
s += txt(420, 134, '时间轴与相位角双刻度联动;箭头表示动作间关联(绿色实线 FS 严格顺序 / 琥珀虚线 SS 并行重叠);跨循环动作自动拆分并标注', { size: 13, fill: C.dim });
const phases = [
['上料相位', 0, 70, PAL[0]],
['夹紧相位', 55, 115, PAL[1]],
['加工相位', 105, 320, PAL[2]],
['检测相位', 300, 345, PAL[5]],
['下料相位', 335, 385, PAL[4]],
['上料相位', 0, 70],
['夹紧相位', 55, 115],
['加工相位', 105, 320],
['检测相位', 300, 345],
['下料相位', 335, 385],
];
phases.forEach(([name, a0, a1, col]) => {
s += rect(X0, 152, SPAN, 34, { rx: 6, fill: C.accent, opacity: 0.08 });
s += rect(X0, 152, SPAN, 34, { rx: 6, stroke: C.line2, sw: 1 });
phases.forEach(([name, a0, a1]) => {
const x = px(a0), w = Math.max(px(Math.min(a1, 360)) - x, 2);
s += rect(x, 152, w, 34, { rx: 6, fill: col, opacity: 0.24 });
s += rect(x, 152, w, 34, { rx: 6, stroke: col, sw: 1, opacity: 0.8 });
if (w > 60) s += txt(x + w / 2, 169, name, { size: 12.5, anchor: 'middle', fill: col, weight: 600 });
if (a1 > 360) s += rect(X0, 152, px(a1 - 360) - X0, 34, { rx: 6, fill: col, opacity: 0.16, dash: '5 5' });
if (a0 > 0) s += line(x, 152, x, 186, { stroke: C.line2, sw: 1, dash: '4 4' });
if (w > 60) s += txt(x + w / 2, 169, name, { size: 12.5, anchor: 'middle', fill: C.sub, weight: 600 });
if (a1 > 360) {
const wx = px(a1 - 360) - X0;
s += rect(X0, 152, wx, 34, { rx: 6, fill: C.accent, opacity: 0.08, dash: '5 5' });
s += line(X0 + wx, 152, X0 + wx, 186, { stroke: C.line2, sw: 1, dash: '4 4' });
}
});
s += line(X0, 196, X1, 196, { stroke: C.line2, sw: 1 });
@@ -866,7 +883,8 @@ function barView() {
const wx = px(a.a1 - 360) - X0;
s += rect(X0, y, wx, BAR_H, { rx: 8, fill: a.color, opacity: T.tailOp, dash: '6 5' });
s += path(`M ${X0 + 3} ${y + 6} L ${X0 + 3} ${y + BAR_H - 6}`, { stroke: T.selOutline, sw: 2, opacity: 0.8 });
s += txt(X0 + wx + 10, y + BAR_H / 2, '↩ 跨循环延续 25°', { size: 11.5, fill: C.warn });
s += iconAt(X0 + wx + 20, y + BAR_H / 2, 'return', C.warn);
s += txt(X0 + wx + 36, y + BAR_H / 2, '跨循环延续 25°', { size: 11.5, fill: C.warn });
}
const inside = w > 150;
if (inside) {
@@ -982,10 +1000,11 @@ function settingsDialog() {
let s = rect(0, 64, W, H - 64 - 36, { fill: T.overlay, opacity: 0.74 });
s += rect(dx, dy, dw, dh, { rx: 18, fill: T.dialog, stroke: C.line2, sw: 1.2 });
s += line(dx, dy + 64, dx + dw, dy + 64, { stroke: C.line, sw: 1 });
s += txt(dx + 32, dy + 33, '工艺设置', { size: 19, weight: 700 });
s += txt(dx + 32, dy + 33, '工艺参数', { size: 19, weight: 700 });
s += txt(dx + 140, dy + 34, '装配线节拍.seq.json · 循环 2.400 s · 8 动作 · 3 工位', { size: 12.5, fill: C.dim });
s += circle(dx + dw - 36, dy + 32, 14, { stroke: C.line2, sw: 1 });
s += txt(dx + dw - 36, dy + 33, '✕', { size: 13, anchor: 'middle', fill: C.sub });
s += line(dx + dw - 42, dy + 26, dx + dw - 30, dy + 38, { stroke: C.sub, sw: 1.8, cap: 'round' });
s += line(dx + dw - 30, dy + 26, dx + dw - 42, dy + 38, { stroke: C.sub, sw: 1.8, cap: 'round' });
s += rect(dx, dy + 64, 200, dh - 140, { fill: T.navBg });
const nav = ['单位与精度', '循环与相位', '编辑辅助', '显示', '导出', '快捷键'];
@@ -1030,7 +1049,7 @@ function settingsDialog() {
s += circle(x + 24, y + 28, 9, { fill: active ? C.accent : 'none', stroke: active ? C.accent : C.line2, sw: 1.6 });
if (active) s += path(`M ${x + 19} ${y + 28} l 4 4 l 6 -9`, { stroke: T.onAccent, sw: 2, cap: 'round' });
s += txt(x + 42, y + 28, `${u} ${name}`, { size: 14, weight: 600, fill: active ? C.text : C.sub });
s += txt(x + 24, y + 56, `取值范围 ${desc} · 例:105.0° ⇄ 29.17%`, { size: 11.5, fill: C.dim });
s += txt(x + 24, y + 56, `取值范围 ${desc} · 例:105.0° = 29.17%`, { size: 11.5, fill: C.dim });
});
['自动', '0', '1', '2', '3', '4'].forEach((p, i) => {
const bw = 52;
@@ -1051,12 +1070,12 @@ function settingsDialog() {
return r;
};
s += ctrl(cx0, 220, '循环时长(1 圈)', '2.400', UNIT.time);
s += ctrl(cx0 + 244, 220, '起始相位 / 位置', '0.0° (12 点钟)');
s += ctrl(cx0 + 244, 220, '起始相位 / 起点', '0.0° (12 点钟)');
s += ctrl(cx0 + 488, 220, '旋转方向', '顺时针 CW');
s += ctrl(cx0 + 732, 244, '圈数 / 循环显示', '1 圈 = 1 循环');
y += 78;
s += txt(cx0, y, '时间 ↔ 相位 换算', { size: 14.5, weight: 600 });
s += txt(cx0, y, '时间 / 相位 换算', { size: 14.5, weight: 600 });
s += txt(cx0 + 176, y, `当前:1° = ${tfmtAuto(CYCLE_MS / 360)},1% = ${tfmtAuto(CYCLE_MS / 100)},双向实时联动`, { size: 11.5, fill: C.dim });
y += 22;
const cols = [cx0, cx0 + 220, cx0 + 440, cx0 + 660];
@@ -1077,7 +1096,7 @@ function settingsDialog() {
y += 34 + rows.length * 30 + 22;
s += txt(cx0, y, '编辑辅助', { size: 14.5, weight: 600 });
s += txt(cx0 + 86, y, '吸附步长可按时长设置,便于秒级工艺快速对齐', { size: 11.5, fill: C.dim });
s += txt(cx0 + 86, y, '吸附步长可按时长调整,便于秒级工艺快速对齐', { size: 11.5, fill: C.dim });
y += 22;
s += txt(cx0, y + 16, '角度吸附', { size: 12.5, fill: C.sub });
['1°', '5°', '15°'].forEach((t, i) => { s += segBtn(cx0 + 90 + i * 66, y, 60, 34, t, i === 0); });
@@ -1126,6 +1145,6 @@ for (const theme of ['dark', 'light']) {
const suffix = theme === 'dark' ? '' : `-${theme}`;
writeFileSync(join(OUT, `circular-timing${suffix}.svg`), build('circular', theme), 'utf8');
writeFileSync(join(OUT, `bar-timing${suffix}.svg`), build('bar', theme), 'utf8');
writeFileSync(join(OUT, `unit-settings${suffix}.svg`), build('settings', theme), 'utf8');
}
console.log('generated 6 svg (dark + light)');
writeFileSync(join(OUT, 'unit-settings.svg'), build('settings', 'dark'), 'utf8');
console.log('generated 5 svg');