MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / miniLabels

Function miniLabels

graph-ui/tools/handtest-fixes-galaxy.mjs:965–992  ·  view source on GitHub ↗

Alle Beschriftungen im Mini-Galaxy, im DOM gemessen, dazu die Namen der Szene; Paare, die sich ueberlagern.

(page)

Source from the content-addressed store, hash-verified

963
964/** Alle Beschriftungen im Mini-Galaxy, im DOM gemessen, dazu die Namen der Szene; Paare, die sich ueberlagern. */
965async function miniLabels(page) {
966 return page.evaluate(() => {
967 const panel = document.querySelector('.atlas-galaxy');
968 const canvas = panel?.querySelector('canvas')?.getBoundingClientRect();
969 const shown = (el) => { const style = getComputedStyle(el); return style.visibility !== 'hidden' && style.display !== 'none' && el.getBoundingClientRect().width > 0; };
970 const dom = [...(panel?.querySelectorAll('.atlas-galaxy-root-marker b, .atlas-galaxy-path-node b, .atlas-galaxy-path-label, [data-testid="atlas-hierarchy-edge-label"], .atlas-hierarchy-band-label') ?? [])]
971 .filter(shown).map((el) => { const r = el.getBoundingClientRect(); return { text: el.textContent?.trim() ?? '', left: r.left, right: r.right, top: r.top, bottom: r.bottom }; });
972 const fit = globalThis.__atlasGalaxyFit;
973 const sprites = (globalThis.__atlasGalaxy?.labelBoxes ?? []).map((box) => {
974 const [a, b] = typeof fit?.project === 'function' ? fit.project([{ x: box.x - box.width / 2, y: box.y + box.height / 2, z: 0 }, { x: box.x + box.width / 2, y: box.y - box.height / 2, z: 0 }]) : [];
975 return a && b && canvas ? { text: box.name, left: canvas.left + Math.min(a.x, b.x), right: canvas.left + Math.max(a.x, b.x), top: canvas.top + Math.min(a.y, b.y), bottom: canvas.top + Math.max(a.y, b.y) } : null;
976 }).filter(Boolean);
977 const all = [...dom, ...sprites];
978 const hit = (a, b) => !(a.right <= b.left || b.right <= a.left || a.bottom <= b.top || b.bottom <= a.top);
979 const overlaps = [];
980 for (let i = 0; i < all.length; i += 1) for (let j = i + 1; j < all.length; j += 1) if (hit(all[i], all[j])) overlaps.push(`${all[i].text} x ${all[j].text}`);
981 const outside = canvas ? all.filter((r) => r.left < canvas.left - 0.5 || r.right > canvas.right + 0.5 || r.top < canvas.top - 0.5 || r.bottom > canvas.bottom + 0.5).map((r) => r.text) : [];
982 // Der Ring einer Marke sitzt auf ihrem Anker (die Marke selbst ist 0 x 0 px gross).
983 const markers = [...(panel?.querySelectorAll('[data-testid="atlas-galaxy-root-marker"]') ?? [])].map((el) => {
984 const r = el.getBoundingClientRect();
985 return { name: el.querySelector('b')?.textContent ?? '', slot: el.getAttribute('data-name-slot'),
986 ringInCanvas: Boolean(canvas && r.left >= canvas.left && r.left <= canvas.right && r.top >= canvas.top && r.top <= canvas.bottom) };
987 });
988 const round = (r) => ({ text: r.text, left: Math.round(r.left), top: Math.round(r.top), right: Math.round(r.right), bottom: Math.round(r.bottom) });
989 return { labels: all.map(round), overlaps, outside, markers, canvas: canvas ? { width: Math.round(canvas.width), height: Math.round(canvas.height) } : null,
990 scope: panel?.querySelector('.atlas-graph-scope-name')?.textContent ?? '', count: panel?.querySelector('.atlas-graph-scope-count')?.textContent ?? '' };
991 });
992}
993
994async function checkK12(page) {
995 await section(page, 'K12', 'Explore mini-Galaxy of .github/workflows/new_contributor_pr.yml: no two labels overlap, as in the main Galaxy');

Callers 1

lookFunction · 0.85

Calls 2

hitFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected