// 定位新版图标图层的实际设计尺寸(PNG 为 2x) import { readFileSync } from 'node:fs' const j = JSON.parse(readFileSync('.scratch/lanhu-cockpit-asset-replacement/research/raw-v2/desktop-02.json', 'utf8')) function dump(node, depth = 0, maxDepth = 5, path = '') { const p = path ? `${path}/${node.name}` : node.name const pad = ' '.repeat(depth) const text = node.type === 'textLayer' && node.text?.style?.content ? ` "${String(node.text.style.content).slice(0, 12)}"` : '' const exp = node.hasExportImage ? ' [EXPORT]' : '' const img = (node.style?.fills || []).some((f) => f.type === 'image') ? ' [IMG]' : '' console.log(`${pad}${node.type}:${node.name} ${node.frame?.width}x${node.frame?.height}${text}${exp}${img}`) if (depth < maxDepth) for (const ch of node.layers || []) dump(ch, depth + 1, maxDepth, p) } function findByName(node, name, path = '') { const p = path ? `${path}/${node.name}` : node.name if (node.name === name) return { node, path: p } for (const ch of node.layers || []) { const r = findByName(ch, name, p) if (r) return r } return null } for (const g of ['Group 5054', 'Group 5061', 'Group 5056']) { const r = findByName(j.artboard, g) console.log(`\n=== ${g}${r ? ` @ ${r.path}` : ' (not found)'}`) if (r) dump(r.node, 0, 3, r.path.split('/').slice(0, -1).join('/')) }