修正追加轮验收脚本的截图取景

#planExtra 默认 hidden 导致 #routeMap 尺寸 0x0、截图落到页面顶部; 显式移除 hidden 并校验 rect。降级方位示意图会画出 142km 外的出发地, 把市区内 9 个点压成一坨, 验收造数据只给地名不给坐标, 让 SVG 按目的地跨度取景。
This commit is contained in:
2026-11-06 10:00:14 +08:00
parent 1f902bc49b
commit a7fb670181
2 changed files with 11 additions and 2 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 28 KiB

+11 -2
View File
@@ -59,8 +59,11 @@ const NEARBY = {
sights: SIGHT_NAMES.map((n, i) => pt(n, i)), sights: SIGHT_NAMES.map((n, i) => pt(n, i)),
food: FOOD_NAMES.map((n, i) => pt(n, i + 5)), food: FOOD_NAMES.map((n, i) => pt(n, i + 5)),
}; };
// 不给出发地坐标:降级方位示意图会画出 142km 外的起点,把市区内 9 个目的地
// 压成一坨、标签全叠在一起。这是既有的取景行为,与本次修复无关;验收截图专注
// 「追加轮是否仍有多个点」,所以只给地名,让 SVG 按目的地跨度取景。
const ANALYSIS = { const ANALYSIS = {
origin: { name: '河池市金城江区', lat: 24.69562, lon: 108.08091 }, origin: { name: '河池市金城江区' },
candidates: [{ id: 'd1', name: '柳州市', lat: LAT, lon: LON, score: 9.1 }], candidates: [{ id: 'd1', name: '柳州市', lat: LAT, lon: LON, score: 9.1 }],
timeRange: { start: '2026-11-20', end: '2026-11-21', days: 2 }, timeRange: { start: '2026-11-20', end: '2026-11-21', days: 2 },
dataNotes: [], dataNotes: [],
@@ -155,6 +158,10 @@ let chrome = null;
state.ai.amapKey = ''; state.ai.amapKey = '';
if (!state.config) state.config = {}; if (!state.config) state.config = {};
state.config.features = { ...(state.config.features || {}), amapRoad: false }; state.config.features = { ...(state.config.features || {}), amapRoad: false };
// #planExtra 默认 hidden(runPlan 成功才移除),不拆掉它 #routeMap 尺寸是 0×0,
// 截图会落到页面顶部。这里显式显示,保证截到真实的路线图。
const pe = document.querySelector('#planExtra');
if (pe) pe.classList.remove('hidden');
if (typeof gotoStep === 'function') gotoStep(3); if (typeof gotoStep === 'function') gotoStep(3);
window.__V1 = ${JSON.stringify(V1)}; window.__V1 = ${JSON.stringify(V1)};
window.__V2 = ${JSON.stringify(V2)}; window.__V2 = ${JSON.stringify(V2)};
@@ -213,8 +220,10 @@ let chrome = null;
// 截图:路线图区域 // 截图:路线图区域
const box = await evalJs(`(() => { const box = await evalJs(`(() => {
const r = document.querySelector('#routeMap').getBoundingClientRect(); const r = document.querySelector('#routeMap').getBoundingClientRect();
return { x: r.x + scrollX, y: r.y + scrollY, width: Math.max(r.width, 640), height: Math.max(r.height, 380) }; return { x: r.x + scrollX, y: r.y + scrollY, width: Math.max(r.width, 640), height: Math.max(r.height, 380), rectW: r.width, rectH: r.height };
})()`); })()`);
console.log('路线图区域 =', box);
if (!box.rectW || !box.rectH) throw new Error('#routeMap 尺寸为 0,可能仍在隐藏容器里');
const shot = await S('Page.captureScreenshot', { const shot = await S('Page.captureScreenshot', {
format: 'png', captureBeyondViewport: true, format: 'png', captureBeyondViewport: true,
clip: { ...box, scale: 1 }, clip: { ...box, scale: 1 },