diff --git a/image-annotate/package.json b/image-annotate/package.json
index 10e20b6..ff29f1c 100644
--- a/image-annotate/package.json
+++ b/image-annotate/package.json
@@ -1,7 +1,7 @@
{
"name": "@iwb-plugin/image-annotate",
"private": true,
- "version": "1.2.9",
+ "version": "1.2.10",
"description": "IWB 插件:图片标注 / 修图(编辑器移植自 iwb-plaus 扩展,纯 Canvas 2D)",
"ibwPlugin": {
"id": "image-annotate",
diff --git a/image-annotate/plugin/editor/dom.js b/image-annotate/plugin/editor/dom.js
index ffa2b43..5b1b8e4 100644
--- a/image-annotate/plugin/editor/dom.js
+++ b/image-annotate/plugin/editor/dom.js
@@ -145,7 +145,7 @@ import { bindEvents } from './events.js'
-
+
diff --git a/image-annotate/plugin/editor/events.js b/image-annotate/plugin/editor/events.js
index 36642cc..dc06f88 100644
--- a/image-annotate/plugin/editor/events.js
+++ b/image-annotate/plugin/editor/events.js
@@ -810,7 +810,7 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
const OPT_HINTS = {
crop: '裁剪栏在画布下方;裁剪与选区互斥,确认后可 Ctrl+Z 撤销',
select: '点击选中元素,拖拽移动,手柄缩放',
- picker: '点击画布取色,取完自动切回上一个工具',
+ picker: '点击画布取色;选中形状/文字时取色直接改它的颜色,取完自动切回上一个工具',
hand: '拖拽平移画布;任意工具下按住空格也可以',
marquee: '拖出选区 → 操作条就在选区旁边',
lasso: '按住拖动画圈,松手闭合'
diff --git a/image-annotate/plugin/editor/index.js b/image-annotate/plugin/editor/index.js
index 4e01ee2..0c1dfa7 100644
--- a/image-annotate/plugin/editor/index.js
+++ b/image-annotate/plugin/editor/index.js
@@ -288,7 +288,7 @@ import { toast } from './commands.js'
zoom: S.zoom,
fit: { w: Math.round(S.fitW || 0), h: Math.round(S.fitH || 0) },
layers: S.layers.map(l => ({ id: l.id, name: l.name, z: l.z, locked: !!l.locked, visible: l.visible !== false })),
- shapes: S.shapeLayers.map(s => ({ id: s.id, type: s.type, lw: s.lw, fill: !!s.fill, closed: !!s.closed, z: s.z })),
+ shapes: S.shapeLayers.map(s => ({ id: s.id, type: s.type, lw: s.lw, fill: !!s.fill, closed: !!s.closed, z: s.z, color: s.color })),
texts: S.textLayers.map(t => ({ id: t.id, text: t.text })),
selectedShapeId: S.selectedShapeId,
selectedTextId: S.selectedTextId,
diff --git a/image-annotate/plugin/editor/tools.js b/image-annotate/plugin/editor/tools.js
index a85a5c7..94cf6d4 100644
--- a/image-annotate/plugin/editor/tools.js
+++ b/image-annotate/plugin/editor/tools.js
@@ -323,6 +323,11 @@ import { hexToRgb, rgbToHex } from '../vendor/image-math.js'
export function exitPicker() {
S.tool = (S.prevTool && S.prevTool !== 'picker') ? S.prevTool : 'brush'
S.prevTool = null
+ // 回到的若不是选择/形状类工具,选中态按 setTool 同一套规则清掉,避免画布残留选中框
+ const back = S.tool
+ if (back !== 'select') S.selectedLayerId = null
+ if (back !== 'text' && back !== 'select') S.selectedTextId = null
+ if (back !== 'rect' && back !== 'circle' && back !== 'arrow' && back !== 'pen' && back !== 'select') S.selectedShapeId = null
S.pickerComposite = null
hidePickerTip()
updateToolUI()
@@ -334,6 +339,7 @@ import { hexToRgb, rgbToHex } from '../vendor/image-math.js'
cancelCrop()
hideCropBar()
}
+ // 回到上一个工具后选项栏由 updateToolUI() → renderOptionBar() 按新工具重建
renderObjects()
}
@@ -370,9 +376,12 @@ import { hexToRgb, rgbToHex } from '../vendor/image-math.js'
S.lassoPts = null
}
S.tool = tool
- if (tool !== 'select') S.selectedLayerId = null
- if (tool !== 'text' && tool !== 'select') S.selectedTextId = null
- if (tool !== 'rect' && tool !== 'circle' && tool !== 'arrow' && tool !== 'pen' && tool !== 'select') S.selectedShapeId = null
+ // 吸管是临时取色工具:必须保留选中态,否则「选中形状 → 按 I 取色」时选中被清掉,
+ // applyColorChange 找不到对象,颜色只写进画笔色、形状不变(用户反馈 2026-11-04)
+ const keepSel = tool === 'select' || tool === 'picker'
+ if (!keepSel) S.selectedLayerId = null
+ if (tool !== 'text' && !keepSel) S.selectedTextId = null
+ if (tool !== 'rect' && tool !== 'circle' && tool !== 'arrow' && tool !== 'pen' && !keepSel) S.selectedShapeId = null
S.bitmapDrag = null
S.textDrag = null
S.shapeDrag = null
diff --git a/image-annotate/src/index.js b/image-annotate/src/index.js
index 1748d3a..7d2c51a 100644
--- a/image-annotate/src/index.js
+++ b/image-annotate/src/index.js
@@ -9,7 +9,7 @@
var __IWB_ANNOTATE_MANIFEST__ = {
id: 'image-annotate',
name: '标注 / 修图',
- version: '1.2.9',
+ version: '1.2.10',
apiVersion: 1,
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
@@ -711,6 +711,10 @@ var __IWB_ANNOTATE_MANIFEST__ = {
function exitPicker() {
S.tool = S.prevTool && S.prevTool !== "picker" ? S.prevTool : "brush";
S.prevTool = null;
+ const back = S.tool;
+ if (back !== "select") S.selectedLayerId = null;
+ if (back !== "text" && back !== "select") S.selectedTextId = null;
+ if (back !== "rect" && back !== "circle" && back !== "arrow" && back !== "pen" && back !== "select") S.selectedShapeId = null;
S.pickerComposite = null;
hidePickerTip();
updateToolUI();
@@ -764,9 +768,10 @@ var __IWB_ANNOTATE_MANIFEST__ = {
S.lassoPts = null;
}
S.tool = tool;
- if (tool !== "select") S.selectedLayerId = null;
- if (tool !== "text" && tool !== "select") S.selectedTextId = null;
- if (tool !== "rect" && tool !== "circle" && tool !== "arrow" && tool !== "pen" && tool !== "select") S.selectedShapeId = null;
+ const keepSel = tool === "select" || tool === "picker";
+ if (!keepSel) S.selectedLayerId = null;
+ if (tool !== "text" && !keepSel) S.selectedTextId = null;
+ if (tool !== "rect" && tool !== "circle" && tool !== "arrow" && tool !== "pen" && !keepSel) S.selectedShapeId = null;
S.bitmapDrag = null;
S.textDrag = null;
S.shapeDrag = null;
@@ -2794,7 +2799,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
-
+
@@ -3663,7 +3668,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
var OPT_HINTS = {
crop: "裁剪栏在画布下方;裁剪与选区互斥,确认后可 Ctrl+Z 撤销",
select: "点击选中元素,拖拽移动,手柄缩放",
- picker: "点击画布取色,取完自动切回上一个工具",
+ picker: "点击画布取色;选中形状/文字时取色直接改它的颜色,取完自动切回上一个工具",
hand: "拖拽平移画布;任意工具下按住空格也可以",
marquee: "拖出选区 → 操作条就在选区旁边",
lasso: "按住拖动画圈,松手闭合"
@@ -6157,7 +6162,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
zoom: S.zoom,
fit: { w: Math.round(S.fitW || 0), h: Math.round(S.fitH || 0) },
layers: S.layers.map((l) => ({ id: l.id, name: l.name, z: l.z, locked: !!l.locked, visible: l.visible !== false })),
- shapes: S.shapeLayers.map((s) => ({ id: s.id, type: s.type, lw: s.lw, fill: !!s.fill, closed: !!s.closed, z: s.z })),
+ shapes: S.shapeLayers.map((s) => ({ id: s.id, type: s.type, lw: s.lw, fill: !!s.fill, closed: !!s.closed, z: s.z, color: s.color })),
texts: S.textLayers.map((t) => ({ id: t.id, text: t.text })),
selectedShapeId: S.selectedShapeId,
selectedTextId: S.selectedTextId,
diff --git a/image-annotate/tools/harness.mjs b/image-annotate/tools/harness.mjs
index 0fee3e2..20e2761 100644
--- a/image-annotate/tools/harness.mjs
+++ b/image-annotate/tools/harness.mjs
@@ -96,7 +96,7 @@ const boot = await page.evaluate((png) => {
window.__commands['annotate-selected'].run().catch(() => {})
return { version: window.__manifest.version, settingsSchema: Object.keys(window.__manifest.settings || {}) }
}, PNG)
-check('产物可执行(循环打包未炸)', boot.version === '1.2.9', 'version=' + boot.version)
+check('产物可执行(循环打包未炸)', boot.version === '1.2.10', 'version=' + boot.version)
check('manifest 声明输出预设设置项', boot.settingsSchema.includes('exportPreset') && boot.settingsSchema.includes('panelsCollapsed'), boot.settingsSchema.join(','))
await page.locator('#iwb-editor-overlay').waitFor({ state: 'visible', timeout: 15000 })
@@ -830,6 +830,29 @@ check('选中钢笔路径就地切「描边」', penSelDbg.shapes[penSelDbg.shap
await page.locator('.iwb-editor-optionbar-body [data-opt-toggle="fill"][data-fill-owner="pen"]').click()
penSelDbg = await dbg()
check('再切回「实心」', penSelDbg.shapes[penSelDbg.shapes.length - 1].fill === true)
+// 吸管:选中矢量形状后按 I 取色,颜色必须写回对象(2026-11-04 用户反馈:切吸管后颜色只进画笔、形状不变)
+check('选中矢量形状后切吸管:选中态保留、取色写回形状、取完回到原工具', await (async () => {
+ await page.locator('.iwb-editor-tool[data-tool="select"]').click()
+ const selId = (await dbg()).selectedShapeId
+ if (!selId) return 'pre: 没有选中形状'
+ // 先换成一个可辨识的颜色,便于判断取色真的改了对象
+ await page.locator('.iwb-editor-color-panel-swatch[data-panel-color="#4488ff"]').click()
+ const before = (await dbg()).shapes.find(s => s.id === selId)
+ if (!before || before.color !== '#4488ff') return 'pre: color=' + (before && before.color)
+ await page.keyboard.press('i') // 切吸管
+ const d1 = await dbg()
+ if (d1.tool !== 'picker' || d1.selectedShapeId !== selId) return 'picker: tool=' + d1.tool + ' sel=' + d1.selectedShapeId
+ // 点画面左下角(原图实色区,避开形状本身)
+ await page.mouse.click(liveBox.x + liveBox.width * 0.15, liveBox.y + liveBox.height * 0.85)
+ await page.waitForTimeout(150)
+ const d2 = await dbg()
+ const after = d2.shapes.find(s => s.id === selId)
+ const shapeBar = await page.locator('.iwb-editor-optionbar-body [data-opt-toggle][data-fill-owner="pen"], .iwb-editor-optionbar-body [data-opt-toggle][data-fill-owner="rect"]').count()
+ return d2.tool === 'select' && after && after.color !== '#4488ff' && shapeBar > 0
+ ? true
+ : 'post: tool=' + d2.tool + ' color=' + (after && after.color) + ' shapeBar=' + shapeBar
+})())
+
await page.keyboard.press('Control+z') // 撤销最后一次填充
await page.keyboard.press('Control+z') // 撤销钢笔路径
await page.keyboard.press('Control+z') // 撤销矩形线宽