diff --git a/image-annotate/package.json b/image-annotate/package.json
index 2e4e2d1..812b5fd 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.6",
+ "version": "1.2.7",
"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 2c699ee..f49f7f8 100644
--- a/image-annotate/plugin/editor/dom.js
+++ b/image-annotate/plugin/editor/dom.js
@@ -46,9 +46,9 @@ import { bindEvents } from './events.js'
-
+
-
+
diff --git a/image-annotate/plugin/editor/events.js b/image-annotate/plugin/editor/events.js
index 96fea7a..4818173 100644
--- a/image-annotate/plugin/editor/events.js
+++ b/image-annotate/plugin/editor/events.js
@@ -1738,6 +1738,16 @@ import { hexToRgb, parseRatio, rgbToHex } from '../vendor/image-math.js'
return
}
+ // PS:] 增大 / [ 减小画笔大小(画笔与橡皮共用,光标环即时反馈)
+ if (!mod && !e.altKey && (e.key === '[' || e.key === ']')) {
+ e.preventDefault()
+ const step = S.brushSize >= 64 ? 8 : S.brushSize >= 24 ? 4 : S.brushSize >= 8 ? 2 : 1
+ S.brushSize = clamp(S.brushSize + (e.key === ']' ? step : -step), 1, 300)
+ syncOptionBar()
+ updateCursor()
+ return
+ }
+
// 视图:Ctrl+0 适应窗口 / Ctrl+1 100% / Ctrl+± 缩放(PS 习惯)
if (mod && !e.shiftKey && e.key === '0') { e.preventDefault(); setZoomFit(); return }
if (mod && !e.shiftKey && e.key === '1') { e.preventDefault(); setZoomActual(); return }
diff --git a/image-annotate/plugin/editor/layers.js b/image-annotate/plugin/editor/layers.js
index 60b3542..e4f7cb2 100644
--- a/image-annotate/plugin/editor/layers.js
+++ b/image-annotate/plugin/editor/layers.js
@@ -347,6 +347,10 @@ export function setActiveLayer(id) {
}
S.layers.push(layer)
reorderLayerCanvas()
+ // 新 canvas 必须立刻套上当前视图的显示尺寸/偏移,否则它会以原始像素尺寸
+ // 贴在 stack 原点 —— 表现就是「第一笔画在错误的位置,滚轮缩放后才正常」
+ // (addBlankLayer 一直有这步,这里漏了。2026-11-04 用户反馈)
+ updateLayerCanvasStyles()
setActiveLayer(id)
renderLayerPanel()
return layer
diff --git a/image-annotate/src/index.js b/image-annotate/src/index.js
index 44ce2a7..b0c0e25 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.6',
+ version: '1.2.7',
apiVersion: 1,
capabilities: ['commands', 'nodeActions', 'canvas', 'canvasWrite'],
settings: {
@@ -1743,6 +1743,7 @@ var __IWB_ANNOTATE_MANIFEST__ = {
};
S.layers.push(layer);
reorderLayerCanvas();
+ updateLayerCanvasStyles();
setActiveLayer(id);
renderLayerPanel();
return layer;
@@ -2677,9 +2678,9 @@ var __IWB_ANNOTATE_MANIFEST__ = {
-
+
-
+
@@ -4540,6 +4541,14 @@ var __IWB_ANNOTATE_MANIFEST__ = {
togglePanelsCollapsed();
return;
}
+ if (!mod && !e.altKey && (e.key === "[" || e.key === "]")) {
+ e.preventDefault();
+ const step = S.brushSize >= 64 ? 8 : S.brushSize >= 24 ? 4 : S.brushSize >= 8 ? 2 : 1;
+ S.brushSize = clamp(S.brushSize + (e.key === "]" ? step : -step), 1, 300);
+ syncOptionBar();
+ updateCursor();
+ return;
+ }
if (mod && !e.shiftKey && e.key === "0") {
e.preventDefault();
setZoomFit();
diff --git a/image-annotate/tools/harness.mjs b/image-annotate/tools/harness.mjs
index 5fabd44..19b35c6 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.6', 'version=' + boot.version)
+check('产物可执行(循环打包未炸)', boot.version === '1.2.7', '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 })
@@ -622,6 +622,15 @@ const stampPx = await probe(stampLayerId)
const stampBasePx = await probe('base')
check('画笔落笔自动落「标注」层且该点有像素', stampPx && stampPx[3] > 0,
'layer=' + stampLayerId + ' px=' + JSON.stringify(stampPx))
+// 回归(2026-11-04 用户反馈):首笔自动建层时新 canvas 没套视图样式,
+// 以原始像素尺寸贴在 stack 原点 → 第一笔显示错位,滚轮缩放后才正常
+check('首笔自动建的层立刻获得视图样式(尺寸/偏移与原图层一致,不再裸贴原点)', await page.evaluate((baseId) => {
+ const cs = Array.from(document.querySelectorAll('.iwb-editor-layer-canvas'))
+ const base = cs.find(c => c.style.width && parseFloat(c.style.left) > 0)
+ const fresh = cs[cs.length - 1]
+ return base && fresh && fresh.style.width === base.style.width &&
+ fresh.style.left === base.style.left && fresh.style.top === base.style.top
+}, stampLayerId))
await page.locator('.iwb-editor-tool[data-tool="eraser"]').click()
await drag2(liveBox.x + liveBox.width * 0.3, liveBox.y + liveBox.height * 0.5,
liveBox.x + liveBox.width * 0.55, liveBox.y + liveBox.height * 0.5)
@@ -715,6 +724,15 @@ check('Tab 收起 / 展开侧栏(PS 习惯)', await (async () => {
return collapsed === true && restored === false
})())
+check('[ / ] 增减画笔大小(PS 习惯,画笔橡皮共用)', await (async () => {
+ await page.keyboard.press(']') // 3 → 5? 起始值不定,只验方向与 clamp
+ const up = (await dbg()).toolOptions.brushSize
+ await page.keyboard.press('[')
+ await page.keyboard.press('[')
+ const down = (await dbg()).toolOptions.brushSize
+ return up > down && down >= 1 && up <= 300
+})())
+
check('Ctrl+1 = 100% 实际像素 / Ctrl+0 = 适应窗口', await (async () => {
await page.keyboard.press('Control+1')
const d1 = await dbg()