From 76f765ce5f5072422f2fd9cd8d17fb4186bd48de Mon Sep 17 00:00:00 2001 From: Acaki Date: Thu, 7 Aug 2025 00:21:51 +0800 Subject: [PATCH] fix: disappearing graph when showing and hiding settings panel in stream --- .../ViewControllers/StreamFrameViewController.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/VoidLink/ViewControllers/StreamFrameViewController.m b/VoidLink/ViewControllers/StreamFrameViewController.m index fa260fbc..5ae4ae56 100644 --- a/VoidLink/ViewControllers/StreamFrameViewController.m +++ b/VoidLink/ViewControllers/StreamFrameViewController.m @@ -239,6 +239,9 @@ } else [toolBoxViewController.specialEntries removeObject:@"enterPip"]; + // Always add the stats toggle option + if(![toolBoxViewController.specialEntries containsObject:@"toggleStatsOverlay"]) [toolBoxViewController.specialEntries addObject:@"toggleStatsOverlay"]; + NSLog(@"toolBoxViewController.specialEntries %@", toolBoxViewController.specialEntries); } @@ -342,7 +345,15 @@ } if (reloadSettings) { + // Preserve current statistics overlay state when reloading settings + BOOL currentStatsOverlayEnabled = _settings.statsOverlayEnabled; + BOOL currentEnableGraphs = _settings.enableGraphs; + _settings = [[[DataManager alloc] init] getSettings]; //StreamFrameViewController retrieve the settings here. + + // Restore the current statistics overlay state to maintain consistency between overlay and graphs + _settings.statsOverlayEnabled = currentStatsOverlayEnabled; + _settings.enableGraphs = currentEnableGraphs; } overlayLevel = _settings.statsOverlayLevel.intValue; if(viewIsBeingResized) viewIsBeingResized = false; @@ -377,6 +388,9 @@ selector:@selector(updateStatsOverlay) userInfo:nil repeats:YES]; + } else { + // When stats overlay is disabled, make sure to hide it immediately + [self updateStatsOverlay]; } // Re-create the ImGui view to properly apply the 'enableGraphs' setting