From 6a890ba379db52b9adbc6ac65d3636b9df83c62a Mon Sep 17 00:00:00 2001 From: Charlie Date: Wed, 11 Feb 2026 20:30:32 +1000 Subject: [PATCH] feat: improve debug mode fade animation and simulator checks - Add smooth fade-in/fade-out animations with scale and opacity transforms - Fix text disappearing before box fades by caching text during animation - Prevent debug mode activation when simulator is disconnected - Auto-disable debug mode when simulator disconnects --- MainWindow.xaml | 67 ++++++++++++++++++- .../ViewModels/MainWindowViewModel.cs | 28 ++++++-- 2 files changed, 86 insertions(+), 9 deletions(-) diff --git a/MainWindow.xaml b/MainWindow.xaml index 2122107..a35a468 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -847,18 +847,79 @@ + RenderTransformOrigin="1,0"> + + + + + + OnGround ? "On Ground" : "Airborne"; public string SimulatorName { get => _simulatorName; set { if (value != _simulatorName) { _simulatorName = value; OnPropertyChanged(); } } } - public bool SimulatorConnected { get => _simConnected; set { if (value != _simConnected) { _simConnected = value; if (!value) _msfsNeedsRestartSim = null; OnPropertyChanged(); OnPropertyChanged(nameof(SimulatorConnectionText)); OnPropertyChanged(nameof(SimulatorStatusColor)); OnPropertyChanged(nameof(MsfsNeedsRestartVisibility)); OnPropertyChanged(nameof(MsfsNeedsRestartText)); } } } + public bool SimulatorConnected { get => _simConnected; set { if (value != _simConnected) { _simConnected = value; if (!value) { _msfsNeedsRestartSim = null; if (_debugModeActive) DebugModeActive = false; } OnPropertyChanged(); OnPropertyChanged(nameof(SimulatorConnectionText)); OnPropertyChanged(nameof(SimulatorStatusColor)); OnPropertyChanged(nameof(MsfsNeedsRestartVisibility)); OnPropertyChanged(nameof(MsfsNeedsRestartText)); } } } public string SimulatorConnectionText => SimulatorConnected ? "Connected" : "Disconnected"; public string SimulatorStatusColor => SimulatorConnected ? "LimeGreen" : "Gray"; public bool ServerConnected @@ -164,7 +165,14 @@ private set { _debugModeActive = value; OnPropertyChanged(); - OnPropertyChanged(nameof(DebugModeText)); + + if (value) + { + // Immediately update text when turning on + UpdateDebugModeText(); + } + // Text clears on next enable, not on disable (prevents text vanishing mid-animation) + OnPropertyChanged(nameof(DebugModeVisibility)); } } @@ -182,7 +190,7 @@ private set { _debugStateId = value; OnPropertyChanged(); - OnPropertyChanged(nameof(DebugModeText)); + UpdateDebugModeText(); } } } @@ -190,9 +198,16 @@ private set /// /// Text to display when debug mode is active. /// - public string DebugModeText => _debugModeActive - ? $"DEBUG MODE - State: {_debugStateId} (Press Ctrl+Shift+D to disable)" - : string.Empty; + public string DebugModeText => _debugModeTextCache; + + private void UpdateDebugModeText() + { + // Only update when active to prevent text flash during fade-out + if (!_debugModeActive) return; + + _debugModeTextCache = $"Debug Mode — State: {_debugStateId}"; + OnPropertyChanged(nameof(DebugModeText)); + } /// /// Visibility of the debug mode indicator. @@ -932,6 +947,7 @@ private static string NormalizeDisconnectDetail(string? reason) /// public void ToggleDebugMode() { + if (!SimulatorConnected) return; _pointController?.ToggleDebugMode(); }