Add debug panel body scrolling
This commit is contained in:
parent
1b2150c772
commit
e75997cede
3 changed files with 95 additions and 16 deletions
|
|
@ -44,6 +44,9 @@ internal sealed class DebugUi
|
|||
private Rect panelBounds;
|
||||
private Vector2 mousePosition;
|
||||
private int lastViewportHeight = 720;
|
||||
private float bodyScrollOffset;
|
||||
private float bodyContentHeight;
|
||||
private Rect bodyClipBounds;
|
||||
|
||||
public DebugUi(string title)
|
||||
: this(title, DefaultPanelLeft, DefaultPanelTop, DefaultPanelWidth, [], () => 0, _ => { })
|
||||
|
|
@ -145,6 +148,7 @@ internal sealed class DebugUi
|
|||
WantsKeyboard = false;
|
||||
activeSliderId = null;
|
||||
focusedTextId = null;
|
||||
bodyScrollOffset = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +167,7 @@ internal sealed class DebugUi
|
|||
closeButtonActive = closeButtonHovered && input.LeftMouseDown;
|
||||
foreach (var control in controls.Where(control => control.IsVisible))
|
||||
{
|
||||
control.UpdateHover(mousePosition);
|
||||
control.UpdateHover(mousePosition, bodyClipBounds);
|
||||
control.IsActive = control.Id == activeControlId && input.LeftMouseDown;
|
||||
}
|
||||
|
||||
|
|
@ -196,6 +200,12 @@ internal sealed class DebugUi
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Contains(panelBounds, mousePosition) && ScrollBody(input.WheelDelta))
|
||||
{
|
||||
Layout();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (activeSliderId is { } sliderId)
|
||||
|
|
@ -272,7 +282,7 @@ internal sealed class DebugUi
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!control.HitTest(mousePosition))
|
||||
if (!Contains(bodyClipBounds, mousePosition) || !control.HitTest(mousePosition))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -397,7 +407,8 @@ internal sealed class DebugUi
|
|||
|
||||
DrawTabs(target, smallFormat, rowBrush, hoverRowBrush, activeRowBrush, outlineBrush, primaryBrush, quietBrush, accentBrush);
|
||||
|
||||
foreach (var control in controls.Where(control => control.IsVisible))
|
||||
target.PushAxisAlignedClip(bodyClipBounds, AntialiasMode.Aliased);
|
||||
foreach (var control in controls.Where(control => control.IsVisible && Intersects(control.Bounds, bodyClipBounds)))
|
||||
{
|
||||
control.IsFocused = control.Id == focusedTextId;
|
||||
control.Draw(
|
||||
|
|
@ -417,6 +428,9 @@ internal sealed class DebugUi
|
|||
trackHoverBrush,
|
||||
trackActiveBrush);
|
||||
}
|
||||
target.PopAxisAlignedClip();
|
||||
|
||||
DrawBodyScrollbar(target, quietBrush, accentBrush);
|
||||
|
||||
OpenOptionControl()?.DrawPopup(
|
||||
target,
|
||||
|
|
@ -438,18 +452,73 @@ internal sealed class DebugUi
|
|||
|
||||
private void Layout()
|
||||
{
|
||||
var y = panelTop + HeaderHeight + (tabs.Count > 0 ? TabRowHeight : 0.0f) + 10.0f;
|
||||
foreach (var control in controls.Where(control => control.IsVisible))
|
||||
var bodyTop = panelTop + HeaderHeight + (tabs.Count > 0 ? TabRowHeight : 0.0f) + 10.0f;
|
||||
var maxPanelBottom = MathF.Max(bodyTop + RowHeight, lastViewportHeight - ScreenMargin);
|
||||
var visibleControls = controls.Where(control => control.IsVisible).ToArray();
|
||||
bodyContentHeight = ContentHeight(visibleControls);
|
||||
var desiredBottom = bodyTop + bodyContentHeight + 12.0f;
|
||||
var bottom = lastViewportHeight > 0 ? Math.Min(desiredBottom, maxPanelBottom) : desiredBottom;
|
||||
panelBounds = RectFromEdges(panelLeft, panelTop, panelLeft + panelWidth, bottom);
|
||||
bodyClipBounds = RectFromEdges(panelBounds.Left, bodyTop, panelBounds.Right, MathF.Max(bodyTop, panelBounds.Bottom - 8.0f));
|
||||
bodyScrollOffset = Math.Clamp(bodyScrollOffset, 0.0f, MaxBodyScrollOffset());
|
||||
|
||||
var y = bodyTop - bodyScrollOffset;
|
||||
foreach (var control in visibleControls)
|
||||
{
|
||||
var height = control.LayoutHeight;
|
||||
control.Bounds = RectFromEdges(panelLeft + 10.0f, y, panelLeft + panelWidth - 10.0f, y + height);
|
||||
y += height + (control is SectionControl ? 2.0f : RowGap);
|
||||
}
|
||||
}
|
||||
|
||||
var bottom = lastViewportHeight > 0
|
||||
? Math.Max(y + 12.0f, lastViewportHeight - panelLeft)
|
||||
: y + 12.0f;
|
||||
panelBounds = RectFromEdges(panelLeft, panelTop, panelLeft + panelWidth, bottom);
|
||||
private static float ContentHeight(IReadOnlyList<DebugUiControl> visibleControls)
|
||||
{
|
||||
var height = 0.0f;
|
||||
for (var index = 0; index < visibleControls.Count; index++)
|
||||
{
|
||||
var control = visibleControls[index];
|
||||
height += control.LayoutHeight;
|
||||
if (index < visibleControls.Count - 1)
|
||||
{
|
||||
height += control is SectionControl ? 2.0f : RowGap;
|
||||
}
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
private bool ScrollBody(float wheelDelta)
|
||||
{
|
||||
var maxOffset = MaxBodyScrollOffset();
|
||||
if (maxOffset <= 0.0f)
|
||||
{
|
||||
bodyScrollOffset = 0.0f;
|
||||
return false;
|
||||
}
|
||||
|
||||
var previous = bodyScrollOffset;
|
||||
bodyScrollOffset = Math.Clamp(bodyScrollOffset + (wheelDelta > 0.0f ? -72.0f : 72.0f), 0.0f, maxOffset);
|
||||
return MathF.Abs(bodyScrollOffset - previous) > 0.001f;
|
||||
}
|
||||
|
||||
private float MaxBodyScrollOffset()
|
||||
{
|
||||
return MathF.Max(0.0f, bodyContentHeight - bodyClipBounds.Height + 12.0f);
|
||||
}
|
||||
|
||||
private void DrawBodyScrollbar(ID2D1RenderTarget target, ID2D1SolidColorBrush trackBrush, ID2D1SolidColorBrush thumbBrush)
|
||||
{
|
||||
var maxOffset = MaxBodyScrollOffset();
|
||||
if (maxOffset <= 0.0f || bodyClipBounds.Height <= 0.0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var track = RectFromEdges(panelBounds.Right - 7.0f, bodyClipBounds.Top + 2.0f, panelBounds.Right - 4.0f, bodyClipBounds.Bottom - 2.0f);
|
||||
var thumbHeight = MathF.Max(24.0f, track.Height * bodyClipBounds.Height / MathF.Max(bodyContentHeight + 12.0f, bodyClipBounds.Height));
|
||||
var thumbTop = track.Top + (track.Height - thumbHeight) * bodyScrollOffset / maxOffset;
|
||||
target.FillRectangle(track, trackBrush);
|
||||
target.FillRectangle(RectFromEdges(track.Left, thumbTop, track.Right, thumbTop + thumbHeight), thumbBrush);
|
||||
}
|
||||
|
||||
private Rect CloseButtonBounds()
|
||||
|
|
@ -578,6 +647,14 @@ internal sealed class DebugUi
|
|||
&& point.Y <= bounds.Bottom;
|
||||
}
|
||||
|
||||
private static bool Intersects(Rect a, Rect b)
|
||||
{
|
||||
return a.Left < b.Right
|
||||
&& a.Right > b.Left
|
||||
&& a.Top < b.Bottom
|
||||
&& a.Bottom > b.Top;
|
||||
}
|
||||
|
||||
private static Rect RectFromEdges(float left, float top, float right, float bottom)
|
||||
{
|
||||
return new Rect(left, top, Math.Max(0.0f, right - left), Math.Max(0.0f, bottom - top));
|
||||
|
|
@ -686,9 +763,9 @@ internal sealed class DebugUi
|
|||
|
||||
public virtual bool HitTest(Vector2 mouse) => Contains(Bounds, mouse);
|
||||
|
||||
public virtual void UpdateHover(Vector2 mouse)
|
||||
public virtual void UpdateHover(Vector2 mouse, Rect clipBounds)
|
||||
{
|
||||
IsHovered = IsInteractive && HitTest(mouse);
|
||||
IsHovered = IsInteractive && Contains(clipBounds, mouse) && HitTest(mouse);
|
||||
}
|
||||
|
||||
public virtual void Click(Vector2 mouse)
|
||||
|
|
@ -849,10 +926,10 @@ internal sealed class DebugUi
|
|||
|
||||
public bool IsOpen => isOpen;
|
||||
|
||||
public override void UpdateHover(Vector2 mouse)
|
||||
public override void UpdateHover(Vector2 mouse, Rect clipBounds)
|
||||
{
|
||||
hoveredOptionIndex = -1;
|
||||
IsHovered = HitTest(mouse);
|
||||
IsHovered = Contains(clipBounds, mouse) && HitTest(mouse);
|
||||
}
|
||||
|
||||
public void UpdatePopupHover(Vector2 mouse, int viewportHeight)
|
||||
|
|
@ -1786,10 +1863,10 @@ internal sealed class DebugUi
|
|||
return Contains(SliderInteractionBounds(), mouse);
|
||||
}
|
||||
|
||||
public override void UpdateHover(Vector2 mouse)
|
||||
public override void UpdateHover(Vector2 mouse, Rect clipBounds)
|
||||
{
|
||||
thumbHovered = Contains(ThumbInteractionBounds(), mouse);
|
||||
trackHovered = !thumbHovered && Contains(TrackInteractionBounds(), mouse);
|
||||
thumbHovered = Contains(clipBounds, mouse) && Contains(ThumbInteractionBounds(), mouse);
|
||||
trackHovered = Contains(clipBounds, mouse) && !thumbHovered && Contains(TrackInteractionBounds(), mouse);
|
||||
IsHovered = trackHovered || thumbHovered;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,4 +138,5 @@
|
|||
{"timestamp":"2026-05-18T07:16:00+01:00","topic":"zyphos-nested-domains-and-umbros-authority","lesson":"Zyphos' `.aquageo` patch now declares solar, orbital, planetary, and lat/long domains before terrain tiles, giving fractal DSL nodes explicit nested reference frames. The Zyphos/Umbros binary constants live in `ZyphosUmbrosSystem`: Umbros is a fixed-sky 0.9-radius twin at 8 Zyphos radii, while the dim primary star phase moves through the Zyphos-local frame for first-pass eclipse cadence. Do not reintroduce moon language or hidden orbital constants in shader files.","files":["src/Aquarium.Zyphos/Worlds/zyphos-first-fractal-terrain.aquageo","src/Aquarium.Zyphos/ZyphosUmbrosSystem.cs","src/Aquarium.Zyphos/Shaders/D3D12ZyphosPlanet.hlsl","src/Aquarium.Zyphos/Shaders/D3D12ZyphosUmbros.hlsl","tests/Aquarium.Engine.Fractal.Tests/ZyphosUmbrosSystemTests.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs"],"source":"user asked to express nested solar/orbital/planetary/lat-long domains and verify Zyphos/Umbros/parent-star modeling against worldbuilding docs"}
|
||||
{"timestamp":"2026-05-18T07:31:00+01:00","topic":"fractal-domain-graph-validation","lesson":"Nested fractal domains are now validated by `FractalDomainGraph`, which owns duplicate-key checks, parent existence, cycle detection, and root-to-leaf path queries. Keep domain topology in this grammar-layer boundary until real transform math exists; do not scatter parent lookup or reference-frame assumptions through render code.","files":["src/Aquarium.Engine.Fractal/Grammar/FractalDomainGraph.cs","src/Aquarium.Engine.Fractal/Grammar/FractalOwnershipTree.cs","src/Aquarium.Engine.Fractal/Debug/FractalDebugDump.cs","tests/Aquarium.Engine.Fractal.Tests/FractalDslCompilerTests.cs","tests/Aquarium.Engine.Fractal.Tests/FractalDebugDumpTests.cs"],"source":"follow-up slice after `.aquageo` gained solar/orbital/planetary/lat-long domains"}
|
||||
{"timestamp":"2026-05-18T08:03:00+01:00","topic":"zyphos-camera-composer-and-space-view","lesson":"Zyphos should not render the legacy height-field Grid in the space view. Aquarium frames now carry a 3D camera target and scene flags so clients can disable the height-field trace and request a starfield background. `ZyphosCameraComposer` separates tracked subject from parent composition anchor, borrowing the Cinemachine idea of composer-owned framing rather than embedding camera aim in world objects.","files":["src/Aquarium.Engine.Contracts/AquariumFrame.cs","src/Aquarium.Engine.Contracts/Render/AquariumRenderPlan.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","src/Aquarium.Zyphos/ZyphosCameraComposer.cs","src/Aquarium.Zyphos/ZyphosRuntime.cs","src/Aquarium.Zyphos/ZyphosSceneBuilder.cs"],"source":"user saw the Zyphos screenshot, rejected the visible Grid, asked for starry background and camera locks informed by Cinemachine composer behavior"}
|
||||
{"timestamp":"2026-05-18T08:22:00+01:00","topic":"debug-ui-panel-scrolling","lesson":"DebugUi panels now own body scrolling, body clipping, and a visible scrollbar when controls exceed the viewport. Individual controls can still own local scrolling for text boxes and option popups, but panel overflow is an engine-level invariant so client panels cannot spill out of their frame.","files":["src/Aquarium.Engine/Render/Ui/DebugUi.cs"],"source":"user reported Zyphos UI did not fit its panel and expected all panels to have scrollbars"}
|
||||
{"timestamp":"2026-05-18T04:09:10+01:00","topic":"face-voice-proximity-routing","lesson":"Face voice is now routed through typed endpoint rows instead of one global session. `FaceVoiceRouter` selects the active endpoint by cursor/listener proximity when auto-route is enabled, while each `FaceVoiceEndpoint` owns its thread id, voice, prompt, enabled state, and XY anchor before delegating transport to `RealtimeFaceVoiceSession`. This keeps multi-Face speech routing explicit and spatial, while the next impurity to cut is manual XY placement: endpoint anchors should bind to real Face/body visual projections once those projections are exposed as a CPU-visible contract.","files":["src/Aquarium.Epiphany/Voice/FaceVoiceRouter.cs","src/Aquarium.Epiphany/Voice/FaceVoiceEndpoint.cs","src/Aquarium.Epiphany/AquariumRuntime.cs","src/Aquarium.Epiphany/State/AquariumLiveState.cs","state/map.yaml"],"source":"user asked to hook the voice path up while keeping in mind several Faces selected by spatial proximity"}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,7 @@ renderer_state:
|
|||
- SDF light buffer feeds Self emission and direct object lighting; future other Selves should join this light lane, not a generic field-instance table.
|
||||
- Studio2 PMREM and irradiance DDS cubemaps are loaded as D3D12 TextureCubes; PMREM serves roughness-mip specular, irradiance serves Lambertian diffuse IBL for non-metal bodies.
|
||||
- DirectWrite/Direct2D unified debug panel with tabs for Aquarium renderer controls, client-declared debug panels, terminal commands, and engine/client tooling surfaces.
|
||||
- DirectWrite/Direct2D debug panels own body scrolling and clipping; overflowing client controls must stay inside the panel with a visible scrollbar.
|
||||
- Aquarium exposes an optional synth/audio hosting boundary through AquariumSynthDocument; Aquarium consumes AquaSynth.Faust as a pinned repo-local NuGet package so synth-agent construction cannot break Aquarium builds until the package is intentionally updated. AquaSynth.Core arrives transitively for patch editor/parser surfaces.
|
||||
- Aquarium now exposes a generic queued PCM audio lane through AquariumAudioDocument. Epiphany Face voice uses it to play streamed Codex realtime output without reaching into the engine's WASAPI internals.
|
||||
- Epiphany owns the first native Face realtime voice session controller. It stores loopback app-server URI, thread id, voice, and speech prompt in CultCache live state; starts `thread/realtime/start` with audio output over the experimental Codex app-server WebSocket JSON-RPC edge; sends text utterances; reflects ephemeral transcript/error/audio counters in the debug UI; and treats speech as transient Face surface, not durable memory or project authority.
|
||||
|
|
|
|||
Loading…
Reference in a new issue