Skip to content

fix(frontend): 控件坞图标被 React Flow 内置样式填成实心块(#71 遗漏),恢复描边线条 - #73

Merged
zlZayn merged 3 commits into
mainfrom
fix/dock-icon-fill
Nov 7, 2026
Merged

zlZayn merged 3 commits into
mainfrom
fix/dock-icon-fill

Conversation

@zlZayn

@zlZayn zlZayn commented Nov 7, 2026

Copy link
Copy Markdown
Collaborator

改了什么

控件坞那九行的图标原本是实心色块、还被缩到 12px,现在恢复成与插件版一致的描边线条(14px、strokeWidth 1.7)。

修法是 index.css 里加一条覆盖:

.studio-canvas .react-flow__controls .dock-row svg {
  fill: none;
  width: 14px; height: 14px;
  max-width: none; max-height: none;
}

为什么(#71 漏掉的)

#71 把形状换成了插件版那套内联图标,但没处理容器自带的 svg 样式。控件坞每行就是一颗 React Flow 的 .react-flow__controls-button,而 React Flow 内置:

.react-flow__controls-button svg { width: 100%; max-width: 12px; max-height: 12px; fill: currentColor; }

于是:

  1. fill: currentColor 顶掉 svg 上的 fill="none"(presentation attribute 打不过作者样式)→ 靠 stroke 画的线条被填成实心;
  2. max-width: 12px 把 14px 的图标缩一号。

实测(Chromium computed style):fill 实际是 rgb(82,96,111)、渲染 12×12。

节点右侧操作栏(#71 的另一半)不在 controls 容器里,本来就是正常线条 —— 所以上次只有控件坞出问题。

实测

量 改前 改后
computed fill rgb(82,96,111)(填充) none
渲染尺寸 12 × 12 14 × 14
max-width/height 12px none
stroke-width 1.7px 1.7px(未改)

验证

命令 结果
cd frontend; npm run build 通过(tsc 零错 + vite 构建成功)
cd frontend; npm test 1071 passed(+1 用例,仪表盘 1070 → 1071)
cd frontend; npm run lint 零告警
uv run python scripts/check_docs.py ✔ 链接 545 处可解析;后端 485 / 前端 1071 计数一致

新增用例(canvasStyles.test.ts)锁住 fill: none / max-width: none / width: 14px,删掉任一条就红。

相关 PR

提交拆分

  1. fix(frontend): 控件坞图标压掉 React Flow 内置 svg 的 fill/12px,恢复描边线条
  2. test(frontend): 锁住控件坞图标是描边线条(fill none + 14px)
  3. docs(frontend): 记下 React Flow 会填实控件坞图标这条坑,同步仪表盘 1071

真机截图

隔离实例 + 真实 Chromium、2x 像素、同一窗口号(win=1)。本机 gh 无 --attach,图在此处占位:

08 改前:实心色块 + 12px

09 改后:描边线条 + 14px

@zlZayn zlZayn added the enhancement New feature or request label Nov 7, 2026
@zlZayn zlZayn self-assigned this Nov 7, 2026
@zlZayn
zlZayn merged commit c86a89e into main Nov 7, 2026
4 checks passed
@zlZayn
zlZayn deleted the fix/dock-icon-fill branch November 7, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant