Skip to content

Commit 44e4b47

Browse files
fix(graph): port graphGalaxyQuality tracking and orbit-pause gating from the spacetime campaign
1 parent 14fc296 commit 44e4b47

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

engraphis/dashboard_assets/ledger.js

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
graphWorkspace: '',
1919
graphData: null,
2020
graphDataMode: 'overview',
21+
graphGalaxyQuality: false,
2122
graphDataPreset: 'galaxy',
2223
graphDataIncludeCode: false,
2324
graphDataShowUnlinked: false,
@@ -2338,7 +2339,8 @@
23382339
const freezeRow = byId('graph-freeze-row');
23392340
if (freezeRow) freezeRow.hidden = full;
23402341
const orbitPause = byId('graph-orbit-pause-row');
2341-
if (orbitPause) orbitPause.hidden = full;
2342+
const orbitCapable = galaxy && (!full || state.graphGalaxyQuality);
2343+
if (orbitPause) orbitPause.hidden = !orbitCapable;
23422344
const style = byId('graph-style').value;
23432345
const styleNotes = full ? GRAPH_LOD_STYLE_NOTES : GRAPH_STYLE_NOTES;
23442346
byId('graph-style-note').textContent = styleNotes[style] || styleNotes.classic;
@@ -2359,6 +2361,7 @@
23592361
function updateGraphGalaxyControls() {
23602362
const galaxy = graphIsGalaxy();
23612363
const full = state.graphMode === 'full';
2364+
const orbitCapable = galaxy && (!full || state.graphGalaxyQuality);
23622365
const size = byId('graph-size');
23632366
if (galaxy && !full) {
23642367
if (['degree', 'betweenness'].includes(size.value)) size.dataset.legacyValue = size.value;
@@ -2385,6 +2388,32 @@
23852388
: ['Galactic gravity', 'Black hole mass', 'Local solar gravity', 'Space friction', 'Spring stiffness'];
23862389
['graph-gravitational-constant-label', 'graph-black-hole-mass-label',
23872390
'graph-local-gravitational-constant-label', 'graph-space-damping-label',
2391+
'graph-spring-stiffness-label'].forEach((id, index) => {
2392+
const label = byId(id);
2393+
if (label) label.textContent = forceLabels[index];
2394+
});
2395+
const springLabel = byId('graph-spring-stiffness-label');
2396+
const springCapable = galaxy || (full && !state.graphGalaxyQuality);
2397+
if (springLabel && springLabel.parentElement) {
2398+
springLabel.parentElement.hidden = !springCapable;
2399+
}
2400+
const galaxyRenderer = galaxy && (!full || state.graphGalaxyQuality);
2401+
const everyRenderer = full && !state.graphGalaxyQuality;
2402+
byId('graph-spacetime-summary').textContent = galaxyRenderer
2403+
? 'Spacetime · black-hole orbit controls'
2404+
: everyRenderer ? 'All-node force refinement' : 'Responsive force controls';
2405+
byId('graph-spacetime-note').textContent = galaxyRenderer
2406+
? 'Drag and release a node to slingshot it into a new orbit.'
2407+
: everyRenderer
2408+
? 'These values refine the settled worker layout.'
2409+
: 'These values tune the responsive force layout.';
2410+
byId('graph-orbits-pause-label').textContent = 'Pause orbits';
2411+
byId('graph-orbits-pause-detail').textContent = 'physics';
2412+
byId('graph-orbits-pause').setAttribute('aria-label', 'Pause orbital physics');
2413+
const orbitPauseRow = byId('graph-orbit-pause-row');
2414+
if (orbitPauseRow) orbitPauseRow.hidden = !orbitCapable;
2415+
}
2416+
23882417
'graph-spring-stiffness-label'].forEach((id, index) => {
23892418
const label = byId(id);
23902419
if (label) label.textContent = forceLabels[index];
@@ -3495,6 +3524,7 @@
34953524
state.graphData = data;
34963525
state.graphWorkspace = targetWorkspace;
34973526
state.graphDataMode = targetMode;
3527+
state.graphGalaxyQuality = galaxyQuality;
34983528
state.graphDataPreset = byId('graph-preset').value;
34993529
state.graphDataIncludeCode = responseIncludeCode;
35003530
state.graphDataShowUnlinked = targetShowUnlinked;

0 commit comments

Comments
 (0)