| 12345678910111213141516171819202122232425 |
- // 确认疑似位置符号母版(Group 5054/Frame 双层结构)的实际内容
- import { readFileSync } from 'node:fs'
- for (const file of ['desktop-06.json', 'desktop-08.json']) {
- const j = JSON.parse(readFileSync(`.scratch/lanhu-cockpit-asset-replacement/research/raw/${file}`, 'utf8'))
- function find(node, want, path = '') {
- const p = path ? `${path}/${node.name}` : node.name
- if (node.name === want) return { node, path: p }
- for (const ch of node.layers || []) {
- const r = find(ch, want, p)
- if (r) return r
- }
- return null
- }
- function dump(node, depth = 0) {
- const pad = ' '.repeat(depth)
- const fills = (node.style?.fills || []).map((f) => f.type).join('+')
- const texts = node.type === 'textLayer' && node.text?.style?.content ? ` text="${node.text.style.content}"` : ''
- console.log(`${pad}${node.type}:${node.name} ${Math.round(node.frame?.width ?? 0)}x${Math.round(node.frame?.height ?? 0)} paths=${(node.paths || []).length} fills=${fills}${texts}`)
- for (const ch of (node.layers || []).slice(0, 12)) dump(ch, depth + 1)
- }
- const g = find(j.artboard, 'Group 5054')
- console.log(`\n=== ${j.artboard.name} :: ${g ? g.path : 'not found'}`)
- if (g) dump(g.node)
- }
|