From 3b5a3c02f04c45d8deea4c75707048c000f35e80 Mon Sep 17 00:00:00 2001 From: Cory Date: Sat, 30 May 2026 21:09:38 -0500 Subject: [PATCH] Fix stream stats toggle not hiding diagnostics overlays --- .../Diagnostics/StreamCompactStatsHUD.swift | 39 ++++++++++++------- .../Streaming/Overlay/StreamOverlay.swift | 1 + .../Overlay/StreamOverlayComposition.swift | 3 +- .../Features/Streaming/StreamView.swift | 1 + 4 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Apps/Stratix/Sources/Stratix/Features/Streaming/Diagnostics/StreamCompactStatsHUD.swift b/Apps/Stratix/Sources/Stratix/Features/Streaming/Diagnostics/StreamCompactStatsHUD.swift index 709022c..78a52d8 100644 --- a/Apps/Stratix/Sources/Stratix/Features/Streaming/Diagnostics/StreamCompactStatsHUD.swift +++ b/Apps/Stratix/Sources/Stratix/Features/Streaming/Diagnostics/StreamCompactStatsHUD.swift @@ -19,25 +19,36 @@ struct StreamCompactStatsHUD: View { /// Renders the HUD only when stream state or diagnostics require it. var body: some View { if shouldShowHUD { - let position = forcedLLSRHUDActive ? .topLeft : (HUDPosition(rawValue: statsHUDPosition) ?? .topRight) - VStack { - if position.isTop { - hudStrip - Spacer() - } else { - Spacer() - hudStrip - } - } - .frame(maxWidth: .infinity, alignment: position.isLeft ? .leading : .trailing) - .padding(20) - .allowsHitTesting(false) + hudStrip + .frame(maxWidth: 520, alignment: .leading) + .padding(28) + .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: hudAlignment) + .allowsHitTesting(false) + .transition(.opacity) } } /// Determines whether the compact HUD should be visible for the current stream state. private var shouldShowHUD: Bool { - !overlayVisible && ((showStatsHUD && session.lifecycle == .connected) || forcedLLSRHUDActive || showRuntimeStatusProbe) + !overlayVisible && + showStatsHUD && + session.lifecycle == .connected + } + + + private var hudAlignment: Alignment { + switch statsHUDPosition { + case "topLeft": + return .topLeading + case "bottomLeft": + return .bottomLeading + case "bottomRight": + return .bottomTrailing + case "topRight": + fallthrough + default: + return .topTrailing + } } /// Forces HUD visibility when the renderer enters an LLSR or diagnostic-heavy mode. diff --git a/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlay.swift b/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlay.swift index 1d7e684..5c8a50e 100644 --- a/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlay.swift +++ b/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlay.swift @@ -95,6 +95,7 @@ private struct StreamStatusOverlayPreviewHost: View { ), session: session, surfaceModel: surfaceModel, + showStatsHUD: false, onCloseOverlay: { showOverlay = false }, onDisconnect: {} ) diff --git a/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlayComposition.swift b/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlayComposition.swift index 198a034..151445a 100644 --- a/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlayComposition.swift +++ b/Apps/Stratix/Sources/Stratix/Features/Streaming/Overlay/StreamOverlayComposition.swift @@ -123,6 +123,7 @@ struct StreamStatusOverlay: View { let overlayState: StreamOverlayState let session: (any StreamingSessionFacade)? let surfaceModel: StreamSurfaceModel + let showStatsHUD: Bool let onCloseOverlay: () -> Void let onDisconnect: () -> Void @@ -132,7 +133,7 @@ struct StreamStatusOverlay: View { if overlayState.showsConnectionOverlay { connectingOverlay .transition(.opacity) - } else { + } else if showStatsHUD { VStack { HStack { Spacer() diff --git a/Apps/Stratix/Sources/Stratix/Features/Streaming/StreamView.swift b/Apps/Stratix/Sources/Stratix/Features/Streaming/StreamView.swift index e6ffc46..6a7ce97 100644 --- a/Apps/Stratix/Sources/Stratix/Features/Streaming/StreamView.swift +++ b/Apps/Stratix/Sources/Stratix/Features/Streaming/StreamView.swift @@ -228,6 +228,7 @@ struct StreamView: View { overlayState: overlayState, session: session, surfaceModel: surfaceModel, + showStatsHUD: showStatsHUD, onCloseOverlay: { Task { await streamController.setOverlayVisible(false, trigger: .explicitDismiss)