From 89c8e0a1d8b283240b2be99fdbee740af00d0a08 Mon Sep 17 00:00:00 2001 From: qiqi Date: Mon, 9 Nov 2026 23:41:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(image-vectorize):=20v0.4.2=20=E9=A1=B6?= =?UTF-8?q?=E6=A0=8F=E3=80=8C=E4=BF=9D=E5=AD=98=E4=B8=BA=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E3=80=8D=E4=B8=8E=E3=80=8C=E5=8F=96=E6=B6=88=E3=80=8D=E4=BA=92?= =?UTF-8?q?=E6=8D=A2=EF=BC=8C=E5=9B=9B=E9=A2=97=E6=8C=89=E9=92=AE=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=8F=8F=E8=BE=B9=E9=85=8D=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image-vectorize/README.md | 7 +++++-- image-vectorize/package.json | 2 +- image-vectorize/plugin/ui.css | 10 ++-------- image-vectorize/plugin/ui.js | 6 ++++-- image-vectorize/src/index.js | 14 ++++---------- image-vectorize/tools/harness.mjs | 9 +++++++++ 6 files changed, 25 insertions(+), 23 deletions(-) diff --git a/image-vectorize/README.md b/image-vectorize/README.md index d6cceaa..87db84f 100644 --- a/image-vectorize/README.md +++ b/image-vectorize/README.md @@ -29,8 +29,11 @@ v0.2 换 potrace,并且按用户要求**只做单色 / 灰度**(不做彩色 - **按孤岛拆分**(默认开):每个连通块输出为一个独立 `` 元素,粘到 Figma 就是多个 可单独选中的图层;关掉则整图合并成一个 path(便于整体缩放/移动) - 预览:按住空格对比原图;**滚轮/捏合缩放、左键拖动平移、双击复位**(0.2×–8×);面板显示元素数 / 层数 / 体积 / 耗时 -- 输出:**复制 SVG**(写 `image/svg+xml` + `text/html` + `text/plain` 三种剪贴板口味, - Figma / Illustrator 粘进去就是真矢量)· **下载 SVG** · **保存为节点**(PNG,按输出倍率 1–4× 从矢量重绘) +- 顶栏按钮(左 → 右):**保存为节点** · **复制 SVG** · **下载 SVG** · 取消(四颗统一描边配色,不用绿色主按钮) + - **保存为节点**:PNG,按输出倍率 1–4× 从矢量重绘后写回画布 + - **复制 SVG**:写 `image/svg+xml` + `text/html` + `text/plain` 三种剪贴板口味, + Figma / Illustrator 粘进去就是真矢量 + - **下载 SVG**:存成文件 ## 按孤岛拆分(v0.3) diff --git a/image-vectorize/package.json b/image-vectorize/package.json index bf7e7a7..4251f23 100644 --- a/image-vectorize/package.json +++ b/image-vectorize/package.json @@ -1,7 +1,7 @@ { "name": "@iwb-plugin/image-vectorize", "private": true, - "version": "0.4.1", + "version": "0.4.2", "description": "位图转矢量:potrace(纯 JS)单色/灰度描摹,输出 SVG 与 PNG 节点;对文字、logo、线稿保形好,不需要 wasm", "ibwPlugin": { "id": "image-vectorize", diff --git a/image-vectorize/plugin/ui.css b/image-vectorize/plugin/ui.css index 73b4983..679c578 100644 --- a/image-vectorize/plugin/ui.css +++ b/image-vectorize/plugin/ui.css @@ -75,14 +75,8 @@ .vz-btn:hover { background: #34343f; border-color: #4a4a5c; } .vz-btn:active { background: #2f2f3a; } .vz-btn:disabled { opacity: 0.45; cursor: default; } - -.vz-btn-primary { - background: #1f7a52; - border-color: #27875c; - color: #eafff5; -} -.vz-btn-primary:hover { background: #248a5d; border-color: #2f9c69; } -.vz-btn-primary:disabled { background: #24503e; border-color: #2a5c47; } +/* 顶栏四颗按钮统一走上面这套描边配色(曾经有一颗 .vz-btn-primary 绿色主按钮, + 2026-11-09 用户要求「颜色都用取消按钮的配色」,已去掉)。 */ /* ---------- 主体 ---------- */ .vz-body { diff --git a/image-vectorize/plugin/ui.js b/image-vectorize/plugin/ui.js index 7cc1796..c9378f0 100644 --- a/image-vectorize/plugin/ui.js +++ b/image-vectorize/plugin/ui.js @@ -128,10 +128,12 @@ function viewHTML(name) { '
' + '位图转矢量' + esc(name) + '' + '
' + - '' + + // 顺序:主操作在左,取消在最右(用户 2026-11-09 要求与原先互换)。 + // 四颗按钮同一套描边配色,不再给主操作上绿色填充 —— 用户口径「颜色都用取消按钮的配色」。 + '' + '' + '' + - '' + + '' + '
' + '
' + '
' + diff --git a/image-vectorize/src/index.js b/image-vectorize/src/index.js index f27b395..99e4045 100644 --- a/image-vectorize/src/index.js +++ b/image-vectorize/src/index.js @@ -9,7 +9,7 @@ var __IWB_VECTORIZE_MANIFEST__ = { id: 'image-vectorize', name: '位图转矢量', - version: '0.4.1', + version: '0.4.2', apiVersion: 1, capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'], settings: { @@ -2082,14 +2082,8 @@ var __IWB_VECTORIZE_MANIFEST__ = { .vz-btn:hover { background: #34343f; border-color: #4a4a5c; } .vz-btn:active { background: #2f2f3a; } .vz-btn:disabled { opacity: 0.45; cursor: default; } - -.vz-btn-primary { - background: #1f7a52; - border-color: #27875c; - color: #eafff5; -} -.vz-btn-primary:hover { background: #248a5d; border-color: #2f9c69; } -.vz-btn-primary:disabled { background: #24503e; border-color: #2a5c47; } +/* 顶栏四颗按钮统一走上面这套描边配色(曾经有一颗 .vz-btn-primary 绿色主按钮, + 2026-11-09 用户要求「颜色都用取消按钮的配色」,已去掉)。 */ /* ---------- 主体 ---------- */ .vz-body { @@ -3022,7 +3016,7 @@ var __IWB_VECTORIZE_MANIFEST__ = { }).join("") + '
按孤岛拆分每个连通块一个图层,粘到 Figma 可单独选中;笔画不连的汉字会分成几块
– 元素– 层––
阈值自动按直方图取,手动可救极端图
反相黑底白字时打开
' + segHTML("invert", [["0", "正片"], ["1", "负片"]], params.invert ? 1 : 0) + '
填充 / 背景填充仅「纯单色」生效 · 背景作预览底
"; } function viewHTML(name) { - return '
'; + return '
'; } var ALPHA_TONE = { hard: 0.4, normal: 1, round: 1.2 }; var toneOf = (alphaMax) => alphaMax <= 0.6 ? "hard" : alphaMax >= 1.1 ? "round" : "normal"; diff --git a/image-vectorize/tools/harness.mjs b/image-vectorize/tools/harness.mjs index f877788..637bcb5 100644 --- a/image-vectorize/tools/harness.mjs +++ b/image-vectorize/tools/harness.mjs @@ -153,6 +153,15 @@ check('模态打开:预览区 + 参数面板 + 四个动作按钮齐全', awai document.querySelector('[data-act="save"]') && document.querySelector('[data-act="svg"]') && document.querySelector('[data-act="copy"]') && document.querySelector('[data-act="cancel"]')))) +// 用户 2026-11-09:顶栏「取消」与「保存为节点」互换(主操作在左、取消在最右), +// 且不再给主操作上绿色 —— 四颗按钮用同一套描边配色。 +check('顶栏顺序:保存为节点 → 复制 → 下载 → 取消,且四颗同色', await page.evaluate(() => { + const btns = [...document.querySelectorAll('.vz-header .vz-btn')] + if (btns.map((b) => b.dataset.act).join(',') !== 'save,copy,svg,cancel') return false + const colors = new Set(btns.map((b) => getComputedStyle(b).backgroundColor + '|' + getComputedStyle(b).color)) + return colors.size === 1 +})) + // 高级参数默认展开:用户 2026-11-05 明确要求「不用隐藏」(低频项也一眼能看到) check('高级参数默认展开', await page.evaluate(() => { const box = document.querySelector('[data-adv]')