- 选中失效根因: Vue3 布尔 prop 缺省转换(editable 缺省→false)
withDefaults 默认 true 修复, 左键选中/右键选中/菜单动作全链路打通
- 右键菜单: 右键单元弹操作菜单(顺/逆旋转/镜像/底边对齐/删除)
动作 emit('ctx') 由父组件统一执行, document 级委托
- 3D 三场景: 室内(窗后墙+木地板)/室外(外墙+草地)/影棚(网格)
场景联动背景色, 真实浏览器截图验证三场景渲染
- 菜单动作行为级验证: 旋转后 1600x1800 宽高互换✓ 删除清空✓
49 lines
2.1 KiB
JavaScript
49 lines
2.1 KiB
JavaScript
// 选中问题诊断: 真实点击组合画布单元, 截图对比 + 捕获状态
|
|
import puppeteer from 'puppeteer-core'
|
|
const EDGE = 'C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe'
|
|
const BASE = 'http://localhost:8000'
|
|
const token = process.argv[2]
|
|
|
|
const browser = await puppeteer.launch({
|
|
executablePath: EDGE,
|
|
headless: 'new',
|
|
args: ['--window-size=1440,900', '--enable-unsafe-swiftshader', '--use-gl=angle', '--use-angle=swiftshader'],
|
|
defaultViewport: { width: 1440, height: 900 },
|
|
})
|
|
const page = await browser.newPage()
|
|
page.on('pageerror', e => console.log(`[JS异常] ${String(e).slice(0, 160)}`))
|
|
page.on('console', m => { if (m.type() === 'error') console.log(`[console.error] ${m.text().slice(0, 160)}`) })
|
|
|
|
await page.goto(`${BASE}/combine?token=${encodeURIComponent(token)}`, { waitUntil: 'networkidle2' })
|
|
await page.waitForSelector('.lib-item')
|
|
await page.click('.lib-item')
|
|
await new Promise(r => setTimeout(r, 600))
|
|
|
|
// 取画布盒
|
|
const box = await (await page.$('.canvas-box')).boundingBox()
|
|
console.log('canvas-box:', JSON.stringify(box))
|
|
|
|
// 点击画布几何中心(单一样板居中,必在单元内)
|
|
await page.mouse.click(box.x + box.width / 2, box.y + box.height / 2)
|
|
await new Promise(r => setTimeout(r, 300))
|
|
await page.screenshot({ path: 'D:/Code/huamenchuang/shots/diag-click-center.png' })
|
|
|
|
// 在提示行读取画布 hint(含单元数)
|
|
const hint = await page.$eval('.hud span', el => el.textContent)
|
|
console.log('hint:', hint)
|
|
|
|
// 再点击右下象限(可能在单元外)
|
|
await page.mouse.click(box.x + box.width * 0.85, box.y + box.height * 0.85)
|
|
await new Promise(r => setTimeout(r, 300))
|
|
await page.screenshot({ path: 'D:/Code/huamenchuang/shots/diag-click-outside.png' })
|
|
|
|
// 键盘 Del(若有选中则删除 → 单元数变化可证选中生效)
|
|
await page.keyboard.press('Delete')
|
|
await new Promise(r => setTimeout(r, 400))
|
|
const hint2 = await page.$eval('.hud span', el => el.textContent)
|
|
console.log('Del 后 hint:', hint2)
|
|
|
|
await page.screenshot({ path: 'D:/Code/huamenchuang/shots/diag-after-del.png' })
|
|
await browser.close()
|
|
console.log('诊断完成')
|