feat(image-annotate): v1.16.0 右栏常驻调色面板 + 可拖宽度 + 字号提升一档

This commit is contained in:
qiqi committed 2026-11-09 17:36:44 +08:00
1 parent 6a14f900df
commit a477705c7f
12 files changed
+2983 -238

No files matched your search

+29
View File
@@ -217,6 +217,35 @@ if (!SKIP_PASTE) {
(await page.locator('.iwb-editor-adj-target').textContent()) !== '无图层',
await page.locator('.iwb-editor-adj-target').textContent())
// v1.16:右栏常驻调色面板 + 可拖宽度。真站里 DOM 与 CSS 是分别打包的,
// 只验面板在不在、拖宽后宽度有没有真的变 —— 样式漏打包时这里会直接露出来。
const sideColor = await page.evaluate(() => {
const side = document.querySelector('.iwb-editor-left [data-color-surface="side"]')
if (!side) return null
return {
tabs: side.querySelectorAll('.iwb-color-pop-tab').length,
swatches: side.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]').length,
sv: !!side.querySelector('.iwb-color-sv')
}
})
check('右栏常驻调色面板(色格切换 + 调色器 + 12 个常用色)',
Boolean(sideColor) && sideColor.tabs === 3 && sideColor.swatches === 12 && sideColor.sv,
JSON.stringify(sideColor))
const sideBefore = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
const sideGrip = await page.locator('.iwb-editor-side-resizer').boundingBox()
if (sideGrip) {
await page.mouse.move(sideGrip.x + 3, sideGrip.y + 120)
await page.mouse.down()
await page.mouse.move(sideGrip.x + 3 - 70, sideGrip.y + 120, { steps: 6 })
await page.mouse.up()
await page.waitForTimeout(180)
}
const sideAfter = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
check('右栏可以拖宽(不再固定 220)', sideAfter >= sideBefore + 60, sideBefore + ' → ' + sideAfter)
await page.locator('.iwb-editor-side-resizer').dblclick()
await page.waitForTimeout(150)
// v1.14 字体选择:真站是带 CSP 的环境,这里确认下拉可用、字体切换真的落到了对象上。
// 系统字体不受 CSP 约束(CSP 管的是网络字体),所以只要 canvas 能画就没问题。
const famDbg = () => page.evaluate(() => window.__iwbEditor.__debug())
+77 -10
View File
@@ -1001,7 +1001,7 @@ check('拖调色器改选中形状颜色:历史只增加 1 条', await (async
if (!(await dbg()).selectedShapeId) return 'pre: 没选中形状'
const h0 = (await dbg()).history
await page.locator('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]').click()
const sv = await page.locator('.iwb-color-sv').boundingBox()
const sv = await page.locator('.iwb-editor-color-pop .iwb-color-sv').boundingBox()
await page.mouse.move(sv.x + sv.width * 0.2, sv.y + sv.height * 0.2)
await page.mouse.down()
await page.mouse.move(sv.x + sv.width * 0.9, sv.y + sv.height * 0.85, { steps: 20 })
@@ -1983,7 +1983,7 @@ check('点文字的「描边」格:色板目标是描边(tab 写「描边」
popTextTarget.bgVisible && popTextTarget.noneVisible, JSON.stringify(popTextTarget))
await page.evaluate(() => {
const el = document.querySelector('.iwb-editor-color-hex-input')
const el = document.querySelector('.iwb-editor-color-pop .iwb-editor-color-hex-input')
el.value = '#00a3ff'
el.dispatchEvent(new Event('change', { bubbles: true }))
})
@@ -2019,7 +2019,7 @@ const popBgTarget = await page.evaluate(() => {
check('点文字的「底色」格:色板切到底色', popBgTarget.bgActive && popBgTarget.label === '底色', JSON.stringify(popBgTarget))
await page.evaluate(() => {
const el = document.querySelector('.iwb-editor-color-hex-input')
const el = document.querySelector('.iwb-editor-color-pop .iwb-editor-color-hex-input')
el.value = '#123456'
el.dispatchEvent(new Event('change', { bubbles: true }))
})
@@ -2045,7 +2045,7 @@ check('底色格显示真实颜色(半透明显示,不是实心块)',
await page.locator('.iwb-editor-color-btn[data-color-slot="stroke"]').click()
await page.waitForTimeout(200)
await page.evaluate(() => {
const el = document.querySelector('.iwb-editor-color-hex-input')
const el = document.querySelector('.iwb-editor-color-pop .iwb-editor-color-hex-input')
el.value = '#ff00aa'
el.dispatchEvent(new Event('change', { bubbles: true }))
})
@@ -2062,12 +2062,12 @@ check('文字色 / 描边色 / 底色三格互不串(改一格不动另外两
// 「无」在底色格 = 关掉底色块,颜色留着
await page.locator('.iwb-editor-color-btn[data-color-slot="bg"]').click()
await page.waitForTimeout(200)
await page.evaluate(() => document.querySelector('[data-color-none]').click())
await page.evaluate(() => document.querySelector('.iwb-editor-color-pop [data-color-none]').click())
await page.waitForTimeout(260)
const bgNone = await page.evaluate(() => {
const t = window.__iwbEditor.__debug().texts[0]
const chip = document.querySelector('.iwb-editor-color-pair [data-color-slot="bg"]')
return { bgFill: t.bgFill, bgColor: t.bgColor, cls: chip.className, noneActive: document.querySelector('[data-color-none]').classList.contains('active') }
return { bgFill: t.bgFill, bgColor: t.bgColor, cls: chip.className, noneActive: document.querySelector('.iwb-editor-color-pop [data-color-none]').classList.contains('active') }
})
check('底色格点「无」:关掉底色块、颜色留着,格子回到斜杠态',
bgNone.bgFill === false && bgNone.bgColor === '#123456' && /is-none/.test(bgNone.cls) && bgNone.noneActive,
@@ -2264,7 +2264,7 @@ await page.waitForTimeout(150)
await page.locator('.iwb-editor-color-pop [data-panel-color="#ffd400"]').first().click()
await page.waitForTimeout(200)
const recents = (await dbg()).recentColors
const recentsInPop = await page.locator('.iwb-editor-recent-colors [data-panel-color]').count()
const recentsInPop = await page.locator('.iwb-editor-color-pop .iwb-editor-recent-colors [data-panel-color]').count()
await page.keyboard.press('Escape')
await page.waitForTimeout(120)
check('选过的颜色进入「最近使用」并出现在色板弹层',
@@ -2415,7 +2415,7 @@ check('点填充槽打开色板:目标是填充,并出现「无」按钮',
// 拿黄色/绿色统计会数到别的图形,永远清不到 0。
const mainBefore = await page.evaluate(() => window.__iwbEditor.__debug().color)
await page.evaluate(() => {
const el = document.querySelector('.iwb-editor-color-hex-input')
const el = document.querySelector('.iwb-editor-color-pop .iwb-editor-color-hex-input')
el.value = '#a014b2'
el.dispatchEvent(new Event('change', { bubbles: true }))
})
@@ -2432,13 +2432,13 @@ check('色板里选色写进填充、主色(描边)不动,工具栏填充
// 「无」:关填充,画面清空,但颜色留着
const purpleBefore = await countColorInVec([160, 20, 178], 10)
await page.evaluate(() => document.querySelector('[data-color-none]').click())
await page.evaluate(() => document.querySelector('.iwb-editor-color-pop [data-color-none]').click())
await page.waitForTimeout(320)
const afterNone = await page.evaluate(() => {
const d = window.__iwbEditor.__debug()
const s = d.shapes[d.shapes.length - 1]
const fillBtn = document.querySelector('.iwb-editor-color-pair [data-color-slot="fill"]')
return { fill: s.fill, fillColor: s.fillColor, btnCls: fillBtn.className, noneActive: document.querySelector('[data-color-none]').classList.contains('active') }
return { fill: s.fill, fillColor: s.fillColor, btnCls: fillBtn.className, noneActive: document.querySelector('.iwb-editor-color-pop [data-color-none]').classList.contains('active') }
})
const purpleAfter = await countColorInVec([160, 20, 178], 10)
check('「无」把填充关掉:画面清空、颜色留着(下次点颜色还是它)',
@@ -2553,6 +2553,73 @@ check('右侧栏出现「图片调节」,11 项齐全且顺序固定',
adjRowCount === 11 && adjNames.join('/') === '曝光/明度/对比度/阴影/高光/色相/饱和度/温度/色调/锐度/清晰度',
'rows=' + adjRowCount + ' ' + adjNames.join('/'))
// ---------- v1.16:右栏常驻调色面板 / 两处同步 / 可拖宽度 / 字号 ----------
const sideSurface = await page.evaluate(() => {
const side = document.querySelector('.iwb-editor-left [data-color-surface="side"]')
if (!side) return null
const tabs = [...side.querySelectorAll('.iwb-color-pop-tab')]
return {
tabs: tabs.length,
visibleTabs: tabs.filter(t => !t.hidden).length,
swatches: side.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]').length,
sv: !!side.querySelector('.iwb-color-sv'),
hue: !!side.querySelector('.iwb-color-hue'),
hex: !!side.querySelector('.iwb-editor-color-hex-input')
}
})
check('右栏有常驻调色面板:可调颜色项 + 调色器 + 12 个常用色',
Boolean(sideSurface) && sideSurface.tabs === 3 && sideSurface.visibleTabs >= 1 &&
sideSurface.swatches === 12 && sideSurface.sv && sideSurface.hue && sideSurface.hex,
JSON.stringify(sideSurface))
// 在右栏点常用色 → 弹层里同一色块也必须高亮(两处共用一份颜色状态)
await page.locator('.iwb-editor-left [data-color-surface="side"] [data-panel-color="#00bfa5"]').click()
await page.waitForTimeout(220)
const colorSync = await page.evaluate(() => {
// 只看「常用色」网格:最近使用里同色也会高亮,那是正常的两处提示,不该算进断言
const activeIn = (root) => [...root.querySelectorAll('.iwb-editor-color-swatches [data-panel-color]')]
.filter(b => b.classList.contains('active')).map(b => b.dataset.panelColor)
const side = document.querySelector('.iwb-editor-left [data-color-surface="side"]')
const pop = document.querySelector('.iwb-editor-color-pop')
return { side: activeIn(side), pop: activeIn(pop), color: window.__iwbEditor.__debug().color }
})
check('右栏选色后弹层同一色块同步高亮(不是两套各管各的)',
colorSync.side.length === 1 && colorSync.side[0] === '#00bfa5' &&
colorSync.pop.length === 1 && colorSync.pop[0] === '#00bfa5' && colorSync.color === '#00bfa5',
JSON.stringify(colorSync))
// 拖右栏宽度:侧栏在画布右侧,指针左移 80px ⇒ 宽 80px
const sideW0 = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
const grip = await page.locator('.iwb-editor-side-resizer').boundingBox()
await page.mouse.move(grip.x + grip.width / 2, grip.y + grip.height / 2)
await page.mouse.down()
await page.mouse.move(grip.x + grip.width / 2 - 80, grip.y + grip.height / 2, { steps: 8 })
await page.mouse.up()
await page.waitForTimeout(180)
const sideW1 = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
check('拖右栏手柄:宽度随拖动变大(不是固定 220)',
sideW1 >= sideW0 + 70 && sideW1 <= 520, sideW0 + ' → ' + sideW1)
await page.locator('.iwb-editor-side-resizer').dblclick()
await page.waitForTimeout(180)
const sideW2 = await page.evaluate(() => Math.round(document.querySelector('.iwb-editor-left').getBoundingClientRect().width))
// 注意:aside 是 content-box,width 280 + 左右 padding 24 ⇒ rect 约 304/305。
// 这里跟「拖之前」比才对,写死 280 会误判。
check('双击手柄复位到默认宽度(回到拖动前)', Math.abs(sideW2 - sideW0) <= 2, sideW0 + ' ← ' + sideW2)
const fontSizes = await page.evaluate(() => ({
adjName: getComputedStyle(document.querySelector('.iwb-editor-adj-name')).fontSize,
adjTitle: getComputedStyle(document.querySelector('.iwb-editor-adj-title')).fontSize,
statusbar: getComputedStyle(document.querySelector('.iwb-editor-statusbar')).fontSize,
optionbar: getComputedStyle(document.querySelector('.iwb-editor-optionbar')).fontSize,
layerName: document.querySelector('.iwb-layer-name') ? getComputedStyle(document.querySelector('.iwb-layer-name')).fontSize : null
}))
check('整体字号提升一档(面板行名 12.5 / 标题 13 / 状态栏 12 / 选项栏 13)',
fontSizes.adjName === '12.5px' && fontSizes.adjTitle === '13px' &&
fontSizes.statusbar === '12px' && fontSizes.optionbar === '13px' &&
(!fontSizes.layerName || fontSizes.layerName === '13px'),
JSON.stringify(fontSizes))
/** 合成整幅可见像素后统计:平均亮度 / 灰像素占比 / R、B 均值 */
const adjStat = () => page.evaluate(() => {
const list = [...document.querySelectorAll('.iwb-editor-layer-canvas')]