Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 31
fix(graph): route the four spacetime sliders into d3 forces in non-galaxy mode#177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base:main
Are you sure you want to change the base?
Changes from all commits
434a94cd700bba8ff0dbf8d42016ee514b791e5d0ffddfd94573ec4af18d5f47ecc6055f0e5d3c2e79e3afef952fe00c88031ee8ff1b23d4File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -457,7 +457,7 @@ | ||
| graphAssetSource('/v2-assets/vendor/force-graph.min.js?v=20260727-final'), | ||
| 'ForceGraph', controller.signal, | ||
| )).then(() => loadScript( | ||
| graphAssetSource('/v2-assets/engraphis-graph.js?v=20260815-merge-ready-1'), | ||
| graphAssetSource('/v2-assets/engraphis-graph.js?v=20260828-slider-multiplier-fix'), | ||
| 'EngraphisGraph', controller.signal, | ||
| )).then(() => loadScript( | ||
| graphAssetSource('/v2-assets/engraphis-spacetime.js?v=20260812-stable-orbit-lanes-7'), | ||
| @@ -2379,7 +2379,10 @@ | ||
| const label = byId(id); | ||
| if (label) label.textContent = labels[index]; | ||
| }); | ||
| byId('graph-spacetime-tuning').hidden = !galaxy; | ||
| // The spacetime multipliers are also wired into the d3 forces for every | ||
| // non-Galaxy preset. Keep the controls available wherever those settings | ||
| // have an observable effect; only the labels and summary vary by mode. | ||
| byId('graph-spacetime-tuning').hidden = false; | ||
Comment on lines
+2382
to
+2385
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For responsive non-Galaxy views such as compact, communities, radial, constellation, and original, making the whole panel visible also exposes Spring stiffness and Pause orbits even though neither affects the D3 layout: Useful? React with 👍 / 👎. | ||
| const forceLabels = full | ||
| ? ['Core attraction', 'Core mass', 'Cluster cohesion', 'Settling resistance', 'Link spring'] | ||
| : ['Galactic gravity', 'Black hole mass', 'Local solar gravity', 'Space friction', 'Spring stiffness']; | ||
| @@ -2453,6 +2456,22 @@ | ||
| function graphSliderResponseValue(id, value, baseline) { | ||
| const control = byId(id); | ||
| if (!control) return Number.isFinite(Number(value)) ? Number(value) : baseline; | ||
| /* Spacetime multipliers (galactic gravity, local solar gravity, black hole mass, | ||
| space friction, spring stiffness) are linear controls: the dashboard's | ||
| graphSpacetimeEngineSettings already normalises them to a clean 0..2 range with | ||
| the visible default at 1.0. The 2x response gain centred on the slider's fallback | ||
| would clip the lower quarter of every slider to 0 (e.g. visible 0..50 for the | ||
| gravitational-constant slider all map to engine 0) and compress the visible | ||
| 50..100 range to engine 0..1.0, so the user couldn't tell the difference between | ||
| slider=30 and slider=50. Bypass the gain for these controls so the visible slider | ||
| position maps linearly to the engine value. */ | ||
| if (id === 'graph-gravitational-constant' | ||
| || id === 'graph-local-gravitational-constant' | ||
| || id === 'graph-black-hole-mass' | ||
| || id === 'graph-space-damping' | ||
| || id === 'graph-spring-stiffness') { | ||
| return graphValueInRange(id, value, baseline); | ||
| } | ||
| const raw = graphValueInRange(id, value, baseline); | ||
| const center = Number.isFinite(Number(baseline)) ? Number(baseline) : raw; | ||
| const min = Number(control.min); | ||
| @@ -2506,9 +2525,15 @@ | ||
| return settings; | ||
| }, {}); | ||
| return { | ||
| gravitationalConstant: controls.gravitationalConstant / 50, | ||
| // The engine consumes these values directly as multipliers. The visible default | ||
| // (100 for gravity/local, 160 for black-hole) must reach the engine as 1.0 so the | ||
| // untouched-slider state is a no-op. The earlier / 50 division sent 2.0 at the | ||
| // default and clamped the upper half of the slider to 2.0x, so the user's | ||
| // movements from 100..200 produced no visible effect — the "revert to default" | ||
| // bug. / 100 keeps the default at 1.0x and gives a clean 0..2 range. | ||
| gravitationalConstant: controls.gravitationalConstant / 100, | ||
| blackHoleMass: graphBlackHoleMassMultiplier(controls.blackHoleMass), | ||
| localGravitationalConstant: controls.localGravitationalConstant / 50, | ||
| localGravitationalConstant: controls.localGravitationalConstant / 100, | ||
Comment on lines
+2534
to
+2536
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When these values come from the dashboard, Useful? React with 👍 / 👎. OwnerAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of scope for this PR. ledger.js belongs to the dashboard PR. Closing without a code change in this PR. | ||
| damping: controls.damping, | ||
| springStiffness: controls.springStiffness / 32, | ||
| orbitPaused: state.graphOrbitPaused, | ||
| @@ -2585,12 +2610,21 @@ | ||
| const GRAPH_BLACK_HOLE_MASS_BASELINE = 160; | ||
| function graphBlackHoleMassMultiplier(controlValue) { | ||
| const value = number(controlValue); | ||
| /* Keep the established lower half and neutral default. Above 160, every +10 slider units | ||
| adds exactly +0.10 to the compact central-mass multiplier: 160→1.0, 170→1.1, 180→1.2. | ||
| Local stellar wells remain owned exclusively by Local solar gravity. */ | ||
| return value <= GRAPH_BLACK_HOLE_MASS_BASELINE | ||
| ? Math.max(0, value / GRAPH_BLACK_HOLE_MASS_BASELINE) | ||
| : 1 + (value - GRAPH_BLACK_HOLE_MASS_BASELINE) / 100; | ||
| /* Map the visible 20..500 range to 0.0..2.0 with the default (160) at 1.0. | ||
| Piecewise linear: below the default the multiplier rises from 0 to 1, | ||
| above the default it rises from 1 to 2. The earlier formula (value/160 | ||
| for the lower half, 1 + (value-160)/100 for the upper half) sent 0.125 | ||
| at the slider's HTML minimum and 4.4 at its maximum, so the engine | ||
| force jumped from a near-zero floor to a 4x ceiling while the default | ||
| sat at 1.0 — a 35x range that made the slider feel "alive" only at the | ||
| extremes. The new mapping gives a clean 0..2 range with a smooth, | ||
| predictable response around the default. */ | ||
| if (!Number.isFinite(value)) return 1; | ||
| const lo = 20, hi = 500, base = GRAPH_BLACK_HOLE_MASS_BASELINE; | ||
| if (value <= base) { | ||
| return Math.max(0, (value - lo) / (base - lo)); | ||
| } | ||
| return 1 + (value - base) / (hi - base); | ||
Comment on lines
+2625
to
+2627
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the browser-accessibility Playwright job, AGENTS.md reference: AGENTS.md:L92-L96 Useful? React with 👍 / 👎. | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this new renderer URL,
python -m pytest tests/test_graph_engine_asset.py -qfails intest_primary_graph_dependencies_are_lazy_retryable_and_csp_clean, which still searches forengraphis-graph.js?v=20260815-merge-ready-1; its subsequent assertion also expects the oldledger.jsURL changed in this commit. Update that cache-buster contract alongside both production URLs so the primary offline gate remains green.AGENTS.md reference: AGENTS.md:L42-L46
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR. ledger.js belongs to the dashboard PR. Closing without a code change in this PR.