fix(canvas): 库面板浮窗开着时画布仍可框选;补 globe 图标给浏览器插件 tab
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 51s
Verify (Gitea) / gate (build · unit · facts) (push) Successful in 51s
- 模态层守卫收窄:只有真模态(.iwb-modal-mask/.iwb-ctxmask)才整体拦画布按下; 库面板 .iwb-fullmask 是可拖可连的浮窗,画布露在它外面必须能框选(v3.25.21 引入的回归) - 手势进行中(框选/平移/拖节点/连线/缩放)时 onMove/onUp 不再按 target 断流: 否则指针划过库面板,框选卡住、在面板上松手收不了尾 - ICONS 补 globe(lucide):浏览器插件面板/网页节点此前声明 'globe' 但库里没有,tab 上渲染成空白 - e2e:新增「库面板开着仍能框选」回归测试;⑤⑦⑨ 三条右键菜单测试改到「该节点▸」二级结构
This commit is contained in:
1 parent
3c58e2b07f
commit
c60ecc7366
2 files changed
+62
-15
No files matched your search
@@ -3325,6 +3325,8 @@
|
||||
// 钢笔笔头(lucide pen-tool):位图转矢量插件的专属图标。
|
||||
// 别与 white-bg-800 的 'vector-square' 共用 —— 两个插件同屏时图标一样,认不出谁是谁。
|
||||
'pen-tool': '<path d="M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z"/><path d="m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18"/><path d="m2.3 2.3 7.286 7.286"/><circle cx="11" cy="11" r="2"/>',
|
||||
// 地球(lucide globe):浏览器插件面板/网页节点的专属图标;此前插件声明 'globe' 但库里没有,tab 上渲染成空白
|
||||
globe: '<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>',
|
||||
maximize: '<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>',
|
||||
// 底栏缩放(v3.24.83):放大镜 + / −。别用裸 plus/minus(那是「新建」的语义,跟缩放认不出来)
|
||||
'zoom-in': '<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/><path d="M11 8v6M8 11h6"/>',
|
||||
@@ -3502,8 +3504,6 @@
|
||||
// 组合/任务文本排序(方案1):relay 透明穿透,按「真实文本源节点」坐标统一排序。
|
||||
// 返回 [{ n: 真实文本源节点, text }];ref/停用节点跳过;batch 整块归到 batch 名下(保持既有 batch 语义,不改变其块位置)。
|
||||
// 方案1 组合排序:按每个 combine 入边展开为 (真实文本源, 文本),relay 透明穿透;batch 只取该边 batchSrcId 指定来源。
|
||||
|
||||
|
||||
function relayCompatTasks(ps, nodes, edges) {
|
||||
const r = resolveTaskGraph(ps, nodes, edges)
|
||||
const refs = (r.refs || []).flatMap(refArgsOf)
|
||||
@@ -6913,7 +6913,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
const onMove = (e) => {
|
||||
const target = e && e.target
|
||||
if (target && target.closest && target.closest('.iwb-fullmask, .iwb-lib, .iwb-lib-embedded, .iwb-drawer, .iwb-toolbar, .iwb-rightrail, .iwb-wsrail, .iwb-statusbar, .iwb-minimap, .iwb-hint-bottom, .iwb-modal-mask, .iwb-ctxmask')) return
|
||||
if (!(refs.box || refs.pan || refs.drag || refs.resize || refs.groupResize || refs.connFrom) && target && target.closest && target.closest('.iwb-fullmask, .iwb-lib, .iwb-lib-embedded, .iwb-drawer, .iwb-toolbar, .iwb-rightrail, .iwb-wsrail, .iwb-statusbar, .iwb-minimap, .iwb-hint-bottom, .iwb-modal-mask, .iwb-ctxmask')) return // 手势进行中(框选/平移/拖节点/连线/缩放)不按 target 断流:否则指针划过库面板,框选卡住、松手收不了尾
|
||||
const vp = refs.viewport
|
||||
if (!vp) return
|
||||
// UI 缩放(zoom)下 pointer 坐标是视觉物理像素;画布坐标是布局像素 → 统一除以 uiZoom 对齐
|
||||
@@ -7089,7 +7089,7 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
const onUp = (e) => {
|
||||
const target = e && e.target
|
||||
if (target && target.closest && target.closest('.iwb-fullmask')) return
|
||||
if (!(refs.box || refs.pan || refs.drag) && target && target.closest && target.closest('.iwb-fullmask')) return // 手势中(框选/平移/拖节点)不拦松手:否则指针落在面板上松手,选择框残留、拖动卡死
|
||||
// 节点体纯点击(未超过拖动态阈值):只保持选择,不进入 drag 处理(不污染撤销历史)
|
||||
if (refs.bodyDown && !refs.bodyDown.active) { refs.bodyDown = null; }
|
||||
// 节点组纯点击(未超过阈值):同上,只保留「框内单击=选中整组」的选择结果
|
||||
@@ -8267,8 +8267,8 @@ const tbCenterSeed = (type, refs) => {
|
||||
}
|
||||
if (e.button !== 0) return
|
||||
// 工具栏 / 侧栏 / 面板 / 小地图上的交互不触发画布空白行为(否则点击面板按钮会关掉面板)
|
||||
// 有模态层(设置/备份/确认等)时不响应画布:否则面板里的拖动会漏成框选,松手就把框内的节点选中/移动
|
||||
if (typeof document !== 'undefined' && document.querySelector && document.querySelector('.iwb-modal-mask, .iwb-fullmask, .iwb-ctxmask')) return
|
||||
// 真模态(设置/备份/确认/右键遮罩)才整体拦画布;库面板 .iwb-fullmask 是可拖可连的浮窗,画布露在它外面仍要能框选(面板内起手由下面 target 判定兜住)
|
||||
if (typeof document !== 'undefined' && document.querySelector && document.querySelector('.iwb-modal-mask, .iwb-ctxmask')) return
|
||||
const t0 = e.target
|
||||
if (t0 && t0.closest && (t0.closest('.iwb-toolbar') || t0.closest('.iwb-lib') || t0.closest('.iwb-lib-embedded') || t0.closest('.iwb-drawer') || t0.closest('.iwb-history') || t0.closest('.iwb-history-embedded') || t0.closest('.iwb-rightrail') || t0.closest('.iwb-fullmask') || t0.closest('.iwb-fullpanel') || t0.closest('.iwb-minimap') || t0.closest('.iwb-wsrail') || t0.closest('.iwb-statusbar') || t0.closest('.iwb-hint-bottom') || t0.closest('.iwb-modal-mask') || t0.closest('.iwb-modal') || t0.closest('.iwb-cpick-pop'))) return
|
||||
// 平移画布:按住空格(临时)或选中抓手工具(持续);默认 = 框选节点
|
||||
|
||||
@@ -151,14 +151,15 @@ test('⑤ 气泡删除按钮(2026-11-09 恢复,hover 红、静态灰);
|
||||
await expect(page.locator('[data-node-id="t1"]'), '气泡删除应真删掉该节点').toHaveCount(0)
|
||||
expect(await nodeCount(page), '气泡删除应让节点数 -1').toBe(n0 - 1)
|
||||
|
||||
// 删除入口②:右键菜单
|
||||
// 删除入口②:右键菜单(2026-11-19 收进「该节点▸」二级:一级只剩 添加节点/选中操作/该节点)
|
||||
const n1 = await nodeCount(page)
|
||||
const box = await page.locator('[data-node-id="p1"]').boundingBox()
|
||||
await page.mouse.click(box.x + box.width / 2, box.y + 60, { button: 'right' })
|
||||
await page.waitForTimeout(250)
|
||||
const delItem = page.locator('.iwb-ctxmenu .iwb-ctx-danger')
|
||||
await expect(delItem.first(), '右键菜单应保留「删除」').toBeVisible()
|
||||
await delItem.first().click()
|
||||
await page.locator('.iwb-ctxmenu:not(.iwb-ctx-sub)').locator('.iwb-ctx-item', { hasText: /^该节点/ }).hover()
|
||||
const delItem = page.locator('.iwb-ctxmenu.iwb-ctx-sub .iwb-ctx-danger').filter({ hasText: '删除该节点' })
|
||||
await expect(delItem, '「该节点▸」二级菜单应保留「删除」').toBeVisible()
|
||||
await delItem.click()
|
||||
expect(await nodeCount(page), '右键删除应生效').toBe(n1 - 1)
|
||||
|
||||
// 删除入口③:Delete 键
|
||||
@@ -205,8 +206,10 @@ test('⑦ 右键菜单「重命名节点」也能改名(备用入口)', asyn
|
||||
await boot(page)
|
||||
const nb = await page.locator('[data-node-id="t1"]').boundingBox()
|
||||
await page.mouse.click(nb.x + nb.width / 2, nb.y + 80, { button: 'right' })
|
||||
await expect(page.locator('.iwb-ctxmenu')).toBeVisible()
|
||||
await page.locator('.iwb-ctxmenu .iwb-ctx-item', { hasText: '重命名节点' }).click()
|
||||
await expect(page.locator('.iwb-ctxmenu:not(.iwb-ctx-sub)')).toBeVisible()
|
||||
// 2026-11-19:重命名收进「该节点▸」二级菜单
|
||||
await page.locator('.iwb-ctxmenu:not(.iwb-ctx-sub)').locator('.iwb-ctx-item', { hasText: /^该节点/ }).hover()
|
||||
await page.locator('.iwb-ctxmenu.iwb-ctx-sub .iwb-ctx-item', { hasText: '重命名节点' }).click()
|
||||
await expect(page.locator('.iwb-rename-modal')).toBeVisible()
|
||||
await page.locator('.iwb-rename-input').fill('新名字乙')
|
||||
await page.locator('.iwb-rename-modal .iwb-btn-primary').click()
|
||||
@@ -431,10 +434,11 @@ test('⑨ 节点背景色:气泡色板可选色、刷新后保留、可撤销
|
||||
await expect(page.locator('[data-node-id="n1"]')).toBeVisible({ timeout: 15000 })
|
||||
expect(await bgOf('n1'), '刷新后背景色应保留').toBe(cyanSwatchBg)
|
||||
|
||||
// ⑤ 右键菜单同一入口
|
||||
// ⑤ 右键菜单同一入口(2026-11-19:背景色收进「该节点▸」二级菜单)
|
||||
await page.locator('[data-node-id="n2"]').click({ button: 'right' })
|
||||
const ctxBg = page.locator('.iwb-ctx-item').filter({ hasText: '背景色' })
|
||||
await expect(ctxBg, '右键菜单应有「背景色」').toHaveCount(1)
|
||||
await page.locator('.iwb-ctxmenu:not(.iwb-ctx-sub)').locator('.iwb-ctx-item', { hasText: /^该节点/ }).hover()
|
||||
const ctxBg = page.locator('.iwb-ctxmenu.iwb-ctx-sub .iwb-ctx-item').filter({ hasText: '背景色' })
|
||||
await expect(ctxBg, '「该节点▸」二级菜单应有「背景色」').toBeVisible()
|
||||
await ctxBg.click()
|
||||
await expect(page.locator('.iwb-pop.iwb-bg-palette'), '右键应打开同一套色板').toBeVisible()
|
||||
const purpleSwatchBg = await page.locator('.iwb-bg-palette .iwb-bg-swatch').nth(3).evaluate((e) => getComputedStyle(e).backgroundColor)
|
||||
@@ -985,3 +989,46 @@ test('⑰ 提示词气泡「放大编辑」:单栏所见即所得(Markdown
|
||||
await page.keyboard.press('Control+E')
|
||||
await expect(page.locator('.iwb-prompt-modal'), '非提示词节点按快捷键不应打开').toHaveCount(0)
|
||||
})
|
||||
|
||||
test('⑪ 库面板(资源中心浮窗)开着时,画布空白处仍能框选', async ({ page }) => {
|
||||
// 2026-11-19:v3.25.21 加的「DOM 里有 .iwb-fullmask 就整体拦画布」把框选一起拦了 ——
|
||||
// 资源中心是可拖可连的浮窗,画布露在它外面必须还能框选;只有真模态(.iwb-modal-mask)才整体禁用。
|
||||
await boot(page)
|
||||
await page.locator('.iwb-top-nav-icon[title*="资源中心"]').click()
|
||||
await expect(page.locator('.iwb-fullmask')).toBeVisible()
|
||||
|
||||
// 在画布上找一个**没被浮窗/节点/底栏/侧栏盖住**的空白点(浮窗位置随视口变化,不能写死坐标)
|
||||
const pt = await page.evaluate(() => {
|
||||
const c = document.querySelector('.iwb-canvas')
|
||||
if (!c) return null
|
||||
const r = c.getBoundingClientRect()
|
||||
const blocked = '.iwb-node, .iwb-fullmask, .iwb-fullpanel, .iwb-toolbar, .iwb-statusbar, .iwb-minimap, .iwb-wsrail, .iwb-lib, .iwb-lib-embedded, .iwb-hint-bottom, .iwb-node-floatbar, .iwb-rightrail'
|
||||
for (let fy = 0.15; fy < 0.9; fy += 0.05) {
|
||||
for (let fx = 0.05; fx < 0.95; fx += 0.05) {
|
||||
const x = r.left + r.width * fx
|
||||
const y = r.top + r.height * fy
|
||||
const el = document.elementFromPoint(x, y)
|
||||
if (!el || !el.closest || !el.closest('.iwb-canvas')) continue
|
||||
if (el.closest(blocked)) continue
|
||||
return { x, y }
|
||||
}
|
||||
}
|
||||
return null
|
||||
})
|
||||
expect(pt, '应能在浮窗之外找到画布空白点').toBeTruthy()
|
||||
|
||||
await page.mouse.move(pt.x, pt.y)
|
||||
await page.mouse.down()
|
||||
await page.mouse.move(pt.x + 120, pt.y + 80, { steps: 8 })
|
||||
await expect(page.locator('.iwb-boxsel'), '浮窗开着时空白拖动必须出现框选').toHaveCount(1)
|
||||
await page.mouse.up()
|
||||
await expect(page.locator('.iwb-boxsel'), '松手后框选应清掉').toHaveCount(0)
|
||||
await expect(page.locator('.iwb-fullmask'), '框选不应把库面板关掉').toBeVisible()
|
||||
|
||||
// 浏览器插件面板 tab 应有图标(2026-11-19:宿主此前没有 globe 图标,tab 渲染成空白)。插件未加载时跳过。
|
||||
const bmTab = page.locator('.iwb-fullmask .iwb-res-tab', { hasText: '浏览器' })
|
||||
if (await bmTab.count()) {
|
||||
const svgHtml = await bmTab.locator('svg').first().innerHTML()
|
||||
expect(String(svgHtml).length, '浏览器 tab 图标 svg 应有内容(globe)').toBeGreaterThan(0)
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user