probe-marker-master.mjs 1.3 KB

12345678910111213141516171819202122232425
  1. // 确认疑似位置符号母版(Group 5054/Frame 双层结构)的实际内容
  2. import { readFileSync } from 'node:fs'
  3. for (const file of ['desktop-06.json', 'desktop-08.json']) {
  4. const j = JSON.parse(readFileSync(`.scratch/lanhu-cockpit-asset-replacement/research/raw/${file}`, 'utf8'))
  5. function find(node, want, path = '') {
  6. const p = path ? `${path}/${node.name}` : node.name
  7. if (node.name === want) return { node, path: p }
  8. for (const ch of node.layers || []) {
  9. const r = find(ch, want, p)
  10. if (r) return r
  11. }
  12. return null
  13. }
  14. function dump(node, depth = 0) {
  15. const pad = ' '.repeat(depth)
  16. const fills = (node.style?.fills || []).map((f) => f.type).join('+')
  17. const texts = node.type === 'textLayer' && node.text?.style?.content ? ` text="${node.text.style.content}"` : ''
  18. 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}`)
  19. for (const ch of (node.layers || []).slice(0, 12)) dump(ch, depth + 1)
  20. }
  21. const g = find(j.artboard, 'Group 5054')
  22. console.log(`\n=== ${j.artboard.name} :: ${g ? g.path : 'not found'}`)
  23. if (g) dump(g.node)
  24. }