Skip to content

Put the whole layout tuning surface on a reusable panel - #367

Merged
matt-edmondson merged 2 commits into
mainfrom
claude/physics-tuning-panel
Sep 8, 2026
Merged

Put the whole layout tuning surface on a reusable panel#367
matt-edmondson merged 2 commits into
mainfrom
claude/physics-tuning-panel

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Why

The simulation has eighteen settings and no consuming application could reach them without writing its own sliders. The demo had written some — covering fifteen of the eighteen, leaving StabilityThreshold, OverlapMargin and MaxOverlapCorrection unreachable — and every other application would have had to write the same thing again and drift from it.

What

PhysicsSettingsPanel.Draw(ref PhysicsSettings) draws all eighteen, grouped by the force each belongs to and captioned on hover with what moving it does:

Group Settings
Repulsion strength, minimum distance
Link springs spring strength, rest length, left-to-right bias
Link shaping flattening, flattening margin, untwisting
Gravity strength, origin anchor
Overlap clearance, maximum correction
Motion and limits damping, max force, max speed, substep rate, settled-below

plus the run toggle and a reset that restores the defaults while leaving the run flag alone.

PhysicsSettingsPanel.DrawDiagnostics(engine) reports energy, whether the graph has settled, and the substep count and rate. That readout is what says whether a change helped: a graph that will not settle shows it in the energy long before the eye catches the drift, and one that settles instantly was probably damped into stillness before it finished arranging itself.

Exposing the whole record rather than a chosen subset is deliberate. The forces interact and none can be judged alone — raising repulsion changes what the spring's rest length means, and levelling links only works in the room repulsion made. A setting left off the panel is a setting nobody can reach without recompiling.

Every control marks itself with ktsu.ImGui.Probes, the way the ktsu widgets do rather than the Hexa-backed ones, so a UI test addresses it by the label the user sees instead of by geometry. That is what lets the demo's suite drive all seventeen sliders through the library's own panel — so what is covered is the control a consuming application gets, not a copy of it.

Demo

CleanImNodesDemo now draws that panel instead of its own, losing 203 lines, and keeps only its two presets, which are demo content rather than library surface. Two settings that had been narrowed by float sliders (ImGui edits floats; these are all doubles) now round-trip: a setting the user never touches keeps its full precision rather than being rounded by being looked at.

Verification

  • ImGuiAppDemo.UITests Clean ImNodes 4/4 — including a new test that expands each of the six groups and drags every slider in it, and one that checks all five diagnostics readouts render.
  • ImGui.NodeEditor.Tests 71/71.
  • Solution builds clean in Release.

Two slider labels were made unique along the way (Repulsion strength, Gravity strength): both had been plain "Strength", which is ambiguous to the probe and to a reader following a tooltip.

Not verified visually — this environment is headless. The panel's layout is ordinary ImGui collapsing headers and sliders, but how it reads at the demo's pane width is not something I can check from here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D2KNUKr1xJPTEdDmeF2tQN


Generated by Claude Code

The simulation has eighteen settings and no consuming application could
reach them without writing its own sliders. The demo had written some -
covering fifteen of the eighteen, with StabilityThreshold, OverlapMargin
and MaxOverlapCorrection unreachable - and every other application would
have had to write the same thing again and drift from it.

PhysicsSettingsPanel.Draw(ref PhysicsSettings) draws all eighteen,
grouped by the force each belongs to and captioned on hover with what
moving it does. DrawDiagnostics(engine) reports energy, whether the graph
has settled, and the substep count and rate, which is what says whether a
change to a setting helped: a graph that will not settle shows it in the
energy long before the eye catches the drift, and one that settles
instantly was probably damped into stillness before it finished
arranging itself.

Exposing the whole record rather than a chosen subset is deliberate. The
forces interact and none can be judged alone - raising repulsion changes
what the spring's rest length means, and levelling links only works in
the room repulsion made - so a setting left off the panel is a setting
nobody can reach without recompiling.

Every control marks itself with ktsu.ImGui.Probes, the way the ktsu
widgets do, so a UI test addresses it by the label the user sees rather
than by geometry. That is what lets the demo's suite drive all seventeen
sliders through the library's own panel, so what is covered is the
control a consuming application gets rather than a copy of it.

The demo now draws that panel instead of its own, losing 203 lines, and
keeps only its two presets, which are demo content rather than library
surface.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2KNUKr1xJPTEdDmeF2tQN
KTSU0003 asks for Ensure.NotNull over ArgumentNullException.ThrowIfNull,
for framework compatibility, and dropping the now-unused System using
that left behind satisfies IDE0005.

Reproduced locally first. This container had been building with the ktsu
analyzers dropped, because its SDK is 10.0.111 whose Roslyn is older than
the analyzer package wants and every build failed CS9057; CI runs 10.0.400
and so sees rules this environment could not. Installing that SDK
alongside reproduces the failure exactly and, with it, the whole solution
builds clean with 0 warnings.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2KNUKr1xJPTEdDmeF2tQN
@matt-edmondson
matt-edmondson merged commit f7664ff into main Sep 8, 2026
12 checks passed
@matt-edmondson
matt-edmondson deleted the claude/physics-tuning-panel branch September 8, 2026 13:37
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants