feat(image-annotate): v1.18.0 色板可钉住 + 右列竖向收窄 + 撤销组搬进工具条最右
This commit is contained in:
1 parent
b6d10339f6
commit
a94e5be954
10 files changed
+408
-86
No files matched your search
@@ -193,6 +193,71 @@ check('色板弹层默认收起;点工具栏色点弹出、且整块在视口
|
||||
return inView && !(await pop.isVisible()) ? true : 'box=' + JSON.stringify(box)
|
||||
})())
|
||||
|
||||
// ---------- v1.18 色板弹层:钉住 + 右列竖排(用户 2026-11-10) ----------
|
||||
// 需求原话:「加一个钉住,在需要调色的时候不用每次都要点开」「右边的数值、常用色、最近色
|
||||
// 竖向排」「顺序改为设置、常用色、最近,这三项不用标题,用细横线分割」。
|
||||
await page.locator('.iwb-editor-tool[data-tool="marquee"]').click() // 用选择工具点画布,不落像素
|
||||
await page.locator('.iwb-editor-tools [data-action="toggleColorPop"][data-color-slot="stroke"]').click()
|
||||
await page.waitForTimeout(140)
|
||||
const popLayout = await page.evaluate(() => {
|
||||
const pop = document.querySelector('.iwb-editor-color-pop')
|
||||
const picker = pop.querySelector('.iwb-color-pop-picker')
|
||||
const side = pop.querySelector('.iwb-color-pop-side')
|
||||
const fields = pop.querySelector('.iwb-color-pop-fields')
|
||||
const groups = [...side.querySelectorAll('.iwb-color-group')]
|
||||
const r = (el) => el.getBoundingClientRect()
|
||||
const pr = r(picker)
|
||||
const sr = r(side)
|
||||
const fr = r(fields)
|
||||
const g0 = r(groups[0])
|
||||
// 「最近」组在没有历史色时整块 hidden,rect 全是 0 —— 不能拿它参与几何比较
|
||||
const g1el = groups[1]
|
||||
const g1 = g1el && !g1el.hidden ? r(g1el) : null
|
||||
return {
|
||||
w: Math.round(r(pop).width),
|
||||
h: Math.round(r(pop).height),
|
||||
sideInRight: Math.round(sr.left) >= Math.round(pr.right), // 右列在取色器右边
|
||||
threeStacked: fr.bottom <= g0.top + 1 && (!g1 || g0.bottom <= g1.top + 1), // 设置→常用→最近 自上而下
|
||||
sameColumn: Math.abs(fr.left - g0.left) < 2 && (!g1 || Math.abs(g0.left - g1.left) < 2),
|
||||
dividers: groups.map((g) => getComputedStyle(g).borderTopWidth),
|
||||
labelsVisible: [...pop.querySelectorAll('.iwb-color-group-label')].filter((l) => l.offsetParent !== null).length,
|
||||
swatch: Math.round(r(pop.querySelector('.iwb-editor-color-panel-swatch')).width),
|
||||
}
|
||||
})
|
||||
check('色板右列竖排:设置 → 常用色 → 最近 同一列,1px 细线分隔且没有小标题',
|
||||
popLayout.sideInRight && popLayout.threeStacked && popLayout.sameColumn &&
|
||||
popLayout.labelsVisible === 0 && popLayout.dividers.every((d) => d === '1px'),
|
||||
JSON.stringify(popLayout))
|
||||
check('竖排后弹层比横排版更紧凑(宽度收窄、总高不超过 175px)',
|
||||
popLayout.w < 460 && popLayout.h <= 175, 'w=' + popLayout.w + ' h=' + popLayout.h)
|
||||
// 开发用:ANNOT_SHOT=/tmp/pop.png 出一张色板弹层截图(验证 v1.18 布局)
|
||||
if (process.env.ANNOT_SHOT) await page.locator('.iwb-editor-color-pop').screenshot({ path: process.env.ANNOT_SHOT })
|
||||
|
||||
const pinBtn = page.locator('.iwb-editor-color-pop [data-action="pinColorPop"]')
|
||||
await pinBtn.click()
|
||||
await page.waitForTimeout(90)
|
||||
await page.mouse.click(imgBox.x + imgBox.width * 0.5, imgBox.y + imgBox.height * 0.5)
|
||||
await page.waitForTimeout(140)
|
||||
const pinned = await page.evaluate(() => ({
|
||||
open: !document.querySelector('.iwb-editor-color-pop').hidden,
|
||||
active: document.querySelector('.iwb-editor-color-pop [data-action="pinColorPop"]').classList.contains('active'),
|
||||
saved: window.__settings.colorPopPinned === true,
|
||||
}))
|
||||
check('钉住后点画布不收起,状态写进宿主 settings(下次打开仍钉着)',
|
||||
pinned.open && pinned.active && pinned.saved, JSON.stringify(pinned))
|
||||
|
||||
await pinBtn.click()
|
||||
await page.waitForTimeout(70)
|
||||
await page.mouse.click(imgBox.x + imgBox.width * 0.35, imgBox.y + imgBox.height * 0.4)
|
||||
await page.waitForTimeout(140)
|
||||
const unpinned = await page.evaluate(() => ({
|
||||
open: !document.querySelector('.iwb-editor-color-pop').hidden,
|
||||
saved: window.__settings.colorPopPinned,
|
||||
active: document.querySelector('.iwb-editor-color-pop [data-action="pinColorPop"]').classList.contains('active'),
|
||||
}))
|
||||
check('取消钉住后点画布立即收起(状态回到 false)',
|
||||
!unpinned.open && unpinned.saved === false && !unpinned.active, JSON.stringify(unpinned))
|
||||
|
||||
const drag = async (x1, y1, x2, y2) => {
|
||||
await page.mouse.move(x1, y1)
|
||||
await page.mouse.down()
|
||||
@@ -672,10 +737,9 @@ check('适应窗口后图片底边不被工具条遮挡', await page.evaluate(()
|
||||
check('顶栏输出/导出按钮组贴最右侧(用户裁定 2026-11-04)', await page.evaluate(() => {
|
||||
const hdr = document.querySelector('.iwb-editor-header')
|
||||
const ex = document.querySelector('.iwb-editor-header > .iwb-editor-export-actions')
|
||||
const hist = document.querySelector('.iwb-editor-header > .iwb-editor-history')
|
||||
if (!hdr || !ex || !hist) return false
|
||||
if (!hdr || !ex) return false
|
||||
const h = hdr.getBoundingClientRect(), e = ex.getBoundingClientRect()
|
||||
return h.right - e.right <= 14 && e.left > hist.getBoundingClientRect().right
|
||||
return h.right - e.right <= 14
|
||||
}))
|
||||
|
||||
// 橡皮:1.2.2 回归 —— events.js 少 import getActiveLayer,一按下就 ReferenceError,表现为「橡皮不能擦」
|
||||
@@ -743,11 +807,15 @@ check('顶栏不再有图层层级按钮;视图快捷搬到画布工具栏最
|
||||
const hdrAdd = document.querySelector('.iwb-editor-header [data-action="addBlankLayer"], .iwb-editor-header [data-action="addBitmapLayer"]')
|
||||
const tools = document.querySelector('.iwb-editor-canvas-wrap > .iwb-editor-tools')
|
||||
const kids = tools ? [...tools.children] : []
|
||||
const lastTwo = kids.slice(-2).map(el => el.dataset && el.dataset.action)
|
||||
// v1.18:撤销组搬进来后是 tools 的最后一个子元素,视图快捷退到它前面两位
|
||||
// (中间还夹了一条分隔线 span,没有 data-action,过滤掉)
|
||||
const histEl = kids.find(el => el.classList && el.classList.contains('iwb-editor-history')) || null
|
||||
const lastTwo = kids.filter(el => el !== histEl && el.dataset && el.dataset.action)
|
||||
.slice(-2).map(el => el.dataset.action)
|
||||
return !q('.iwb-editor-more-wrap') && !q('[data-action="toggleMore"]') &&
|
||||
hdrLayerBtns === 0 && !hdrAdd && addBtns === 4 &&
|
||||
!q('.iwb-editor-header [data-action="zoomFit"]') && !q('.iwb-editor-header [data-action="togglePanels"]') &&
|
||||
lastTwo.join(',') === 'zoomFit,togglePanels' &&
|
||||
lastTwo.join(',') === 'zoomFit,togglePanels' && kids[kids.length - 1] === histEl &&
|
||||
q('.iwb-editor-layer-panel-header [data-action="addBlankLayer"]') &&
|
||||
q('.iwb-editor-layer-panel-header [data-action="addBitmapLayer"]') &&
|
||||
q('.iwb-editor-layer-panel-header [data-action="mergeLayers"]') &&
|
||||
@@ -755,7 +823,7 @@ check('顶栏不再有图层层级按钮;视图快捷搬到画布工具栏最
|
||||
}))
|
||||
|
||||
check('「还原原图」图标是循环重置(refresh)而不是垃圾桶', await page.evaluate(() => {
|
||||
const svg = document.querySelector('.iwb-editor-header [data-action="reset"] svg')
|
||||
const svg = document.querySelector('.iwb-editor-tools [data-action="reset"] svg')
|
||||
if (!svg) return false
|
||||
const paths = svg.querySelectorAll('path').length
|
||||
const polys = Array.from(svg.querySelectorAll('polyline')).map(p => p.getAttribute('points')).join('|')
|
||||
@@ -1018,24 +1086,45 @@ 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 hist = q('.iwb-editor-header > .iwb-editor-history')
|
||||
const dl = q('.iwb-editor-header [data-action="download"]')
|
||||
if (!session || !title || !hist || !dl) return false
|
||||
const t = title.getBoundingClientRect(), s = session.getBoundingClientRect(), h = hist.getBoundingClientRect()
|
||||
if (!session || !title || !dl) return false
|
||||
const t = title.getBoundingClientRect(), s = session.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' &&
|
||||
t.left < s.left && s.right < h.left &&
|
||||
t.left < s.left &&
|
||||
!q('.iwb-editor-header > .iwb-editor-history') && // v1.18 搬去工具条最右
|
||||
!q('.iwb-editor-header > .iwb-editor-commands') &&
|
||||
unified && dl.textContent.trim() === '导出' &&
|
||||
!q('.iwb-editor-export-actions [data-action="newNode"]')
|
||||
}))
|
||||
|
||||
// v1.18(用户 2026-11-10):撤销 / 重做 / 还原从顶栏搬到画布底部工具栏最右 —— 手在画布上时够得到
|
||||
check('撤销 / 重做 / 还原 在工具条最右(视图快捷之后,是 tools 的最后一个子元素)', await page.evaluate(() => {
|
||||
const tools = document.querySelector('.iwb-editor-tools')
|
||||
const hist = tools && tools.querySelector('.iwb-editor-history')
|
||||
const fit = tools && tools.querySelector('[data-action="zoomFit"]')
|
||||
const panels = tools && tools.querySelector('[data-action="togglePanels"]')
|
||||
const crop = tools && tools.querySelector('[data-tool="crop"]')
|
||||
if (!hist || !fit || !panels || !crop) return false
|
||||
const acts = [...hist.querySelectorAll('[data-action]')].map((b) => b.dataset.action).join(',')
|
||||
const c = crop.getBoundingClientRect()
|
||||
const f = fit.getBoundingClientRect()
|
||||
const p = panels.getBoundingClientRect()
|
||||
const h = hist.getBoundingClientRect()
|
||||
return acts === 'undo,redo,reset' &&
|
||||
tools.lastElementChild === hist &&
|
||||
c.right <= f.left && f.right <= p.left && p.right <= h.left &&
|
||||
Math.abs(h.top - c.top) < 2 // 与工具按钮同一条水平线,没有掉到第二行
|
||||
}))
|
||||
// 开发用:ANNOT_SHOT_BAR=/tmp/bar.png 出一张工具条截图(验证撤销组落在最右、没有换行)
|
||||
if (process.env.ANNOT_SHOT_BAR) await page.locator('.iwb-editor-tools').screenshot({ path: process.env.ANNOT_SHOT_BAR })
|
||||
check('画笔选项栏:推荐大小只留 4 个快捷点,硬度补 5 个快捷点且滑杆加宽', await (async () => {
|
||||
await page.locator('.iwb-editor-tool[data-tool="brush"]').click()
|
||||
const ok = await page.evaluate(() => {
|
||||
|
||||
Reference in new issue
Block a user