feat(image-annotate): v1.2.11 选中框手柄/旋转手柄/顶栏与选项栏打磨

- 缩放手柄 17px→11px(形状/文字/位图/放置四处统一),命中半径同步收小
- 旋转手柄重绘:细弧+末端小箭头(旋转语义更直观),线更细、色 #f0b34e
- Shift+X 切换选中形状 描边/实心(箭头无实心给提示);isTyping 放行 Shift 组合键,
  参数数字框里按 Shift+X 不再被吞
- 硬度:滑杆 84→140px + 5 个快捷点(0/25/50/75/100);笔刷推荐大小 7→4 个
- 顶栏:标题在最前,新建/覆盖/退出跟其后且三键统一中性色;标题后与撤销组后各加竖分隔
- harness 更新/新增断言(115 项全绿)
This commit is contained in:
qiqi committed 2026-11-04 23:06:39 +08:00
1 parent 0d161d6ded
commit c176744846
10 files changed
+153 -59

No files matched your search

+42 -15
View File
@@ -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.10', 'version=' + boot.version)
check('产物可执行(循环打包未炸)', boot.version === '1.2.11', '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 })
@@ -537,8 +537,8 @@ check('侧栏「实心」按钮已移除(选项栏承担该功能)',
// 快捷点:画笔大小
await page.locator('.iwb-editor-tool[data-tool="brush"]').click()
check('画笔选项栏有 7 个大小快捷点',
(await page.locator('.iwb-editor-optionbar-body [data-opt-preset="brushSize"]').count()) === 7)
check('画笔选项栏有 4 个大小快捷点(16/24/32 已按用户裁定移除)',
(await page.locator('.iwb-editor-optionbar-body [data-opt-preset="brushSize"]').count()) === 4)
await page.locator('.iwb-editor-optionbar-body [data-opt-preset="brushSize"][data-value="12"]').click()
check('点快捷点 12:笔刷大小即时生效且选项栏数字框同步',
(await dbg()).toolOptions.brushSize === 12 &&
@@ -807,6 +807,19 @@ selShapeDbg = await dbg()
check('选中矩形就地改线宽 9', selShapeDbg.shapes[selShapeDbg.shapes.length - 1].lw === 9,
JSON.stringify(selShapeDbg.shapes.slice(-1)))
// Shift+X:选中形状切 描边/实心(PS 风格;数字框输完值直接按也必须生效)
check('Shift+X 切换选中形状 描边/实心(对象与选项栏按钮同步)', await (async () => {
await page.keyboard.press('Shift+x')
const d = await dbg()
const sh = d.shapes.find(s => s.id === d.selectedShapeId)
const btnActive = await page.evaluate(() => document.querySelector('.iwb-editor-optionbar-body [data-opt-toggle="fill"][data-fill-owner="rect"]').classList.contains('active'))
const flipped = sh && sh.fill === true && btnActive
await page.keyboard.press('Shift+x') // 切回描边,恢复现场
const d2 = await dbg()
const sh2 = d2.shapes.find(s => s.id === d2.selectedShapeId)
return flipped && sh2 && sh2.fill === false
})())
// 钢笔:闭合路径选中后同样可切描边/实心
await page.locator('.iwb-editor-tool[data-tool="pen"]').click()
const pA = [liveBox.x + liveBox.width * 0.55, liveBox.y + liveBox.height * 0.25]
@@ -859,25 +872,39 @@ await page.keyboard.press('Control+z') // 撤销矩形线宽
// ---- v1.2.9:会话组(新建/覆盖/退出)移到顶栏最左 + 图层 PS 快捷键 ----
check('顶栏:新建/覆盖/退出 在最左侧(会话组),右侧只剩 输出+导出,下载文案改「导出」', await page.evaluate(() => {
check('顶栏:标题最前 → 新建/覆盖/退出(统一中性色)→ 竖分隔 → 撤销组,右侧只剩 输出+导出', await page.evaluate(() => {
const q = (s) => document.querySelector(s)
const session = q('.iwb-editor-header > .iwb-editor-session')
const title = q('.iwb-editor-header > .iwb-editor-title')
const ex = q('.iwb-editor-header > .iwb-editor-export-actions')
const hist = q('.iwb-editor-header > .iwb-editor-history')
const dl = q('.iwb-editor-header [data-action="download"]')
if (!session || !title || !ex || !dl) return false
if (!session || !title || !hist || !dl) return false
const t = title.getBoundingClientRect(), s = session.getBoundingClientRect(), h = hist.getBoundingClientRect()
const btns = Array.from(session.querySelectorAll('.iwb-editor-btn')).map(b => b.dataset.action).join(',')
const bg = (sel) => getComputedStyle(q(sel)).backgroundColor
const unified = bg('.iwb-editor-header .iwb-editor-btn-new') === bg('.iwb-editor-header .iwb-editor-btn-replace') &&
bg('.iwb-editor-header .iwb-editor-btn-replace') === bg('.iwb-editor-header .iwb-editor-btn-cancel')
return btns === 'newNode,replace,cancel' &&
session.getBoundingClientRect().left < title.getBoundingClientRect().left &&
ex.contains(dl) && dl.textContent.trim() === '导出' &&
!ex.querySelector('[data-action="newNode"]')
}))
check('顶栏会话组左侧留白 ≤ 12px(贴 header 左内边距)', await page.evaluate(() => {
const hdr = document.querySelector('.iwb-editor-header')
const s = document.querySelector('.iwb-editor-header > .iwb-editor-session')
if (!hdr || !s) return false
return s.getBoundingClientRect().left - hdr.getBoundingClientRect().left <= 12
t.left < s.left && s.right < h.left &&
Boolean(q('.iwb-editor-header > .iwb-editor-divider')) &&
unified && dl.textContent.trim() === '导出' &&
!q('.iwb-editor-export-actions [data-action="newNode"]')
}))
check('画笔选项栏:推荐大小只留 4 个快捷点,硬度补 5 个快捷点且滑杆加宽', await (async () => {
await page.locator('.iwb-editor-tool[data-tool="brush"]').click()
const ok = await page.evaluate(() => {
const body = document.querySelector('.iwb-editor-optionbar-body')
if (!body) return false
const size = body.querySelectorAll('[data-opt-preset="brushSize"]').length
const hard = body.querySelectorAll('[data-opt-preset="brushHardness"]').length
const wide = Boolean(body.querySelector('input[data-opt="brushHardness"].iwb-opt-range-wide'))
return size === 4 && hard === 5 && wide
})
await page.locator('.iwb-editor-tool[data-tool="select"]').click()
return ok
})())
// Shift+X:选中形状切 描边/实心(PS 风格,用户裁定 2026-11-04 晚)
// 图层快捷键:Ctrl+]/[ 上/下移、Ctrl+Shift+]/[ 置顶/置底、Alt+]/[ 选层、Delete 删图层
// 注意:__debug().layers 是 S.layers 数组原序,叠放顺序必须看 z(位图与矢量共用一套 z)