Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private struct StreamStatusOverlayPreviewHost: View {
),
session: session,
surfaceModel: surfaceModel,
showStatsHUD: false,
onCloseOverlay: { showOverlay = false },
onDisconnect: {}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -132,7 +133,7 @@ struct StreamStatusOverlay: View {
if overlayState.showsConnectionOverlay {
connectingOverlay
.transition(.opacity)
} else {
} else if showStatsHUD {
VStack {
HStack {
Spacer()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ struct StreamView: View {
overlayState: overlayState,
session: session,
surfaceModel: surfaceModel,
showStatsHUD: showStatsHUD,
onCloseOverlay: {
Task {
await streamController.setOverlayVisible(false, trigger: .explicitDismiss)
Expand Down
Loading