From eb4ee774d6223acbf495d7dd8b2226081d7b0e79 Mon Sep 17 00:00:00 2001 From: "GukSang.Jin" Date: Mon, 11 May 2026 11:46:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- COFTester/MainWindow.xaml | 7 ++++-- COFTester/MainWindow.xaml.cs | 43 ++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/COFTester/MainWindow.xaml b/COFTester/MainWindow.xaml index bc562a2..974b4fd 100644 --- a/COFTester/MainWindow.xaml +++ b/COFTester/MainWindow.xaml @@ -790,7 +790,8 @@ BorderThickness="1" CornerRadius="10" Padding="6"> - + DrawMarginFrame="{x:Null}" + Loaded="RealtimeForceChart_Loaded" + SizeChanged="RealtimeForceChart_SizeChanged" /> diff --git a/COFTester/MainWindow.xaml.cs b/COFTester/MainWindow.xaml.cs index dfc22da..22c2637 100644 --- a/COFTester/MainWindow.xaml.cs +++ b/COFTester/MainWindow.xaml.cs @@ -2,6 +2,7 @@ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; +using System.Windows.Threading; using COFTester.ViewModels; namespace COFTester; @@ -12,6 +13,7 @@ public partial class MainWindow : Window private const double CollapsedSidebarWidth = 118; private readonly MainViewModel _viewModel = new(); private bool _isSidebarCollapsed; + private bool _isRealtimeChartLayoutRefreshQueued; public MainWindow() { @@ -41,6 +43,21 @@ public partial class MainWindow : Window MainWorkspaceTabs.SelectedIndex = 1; } + private void RealtimeForceChart_Loaded(object sender, RoutedEventArgs e) + { + QueueRealtimeChartLayoutRefresh(); + } + + private void RealtimeForceChart_SizeChanged(object sender, SizeChangedEventArgs e) + { + if (e.NewSize.Width <= 0 || e.NewSize.Height <= 0) + { + return; + } + + QueueRealtimeChartLayoutRefresh(); + } + private void TableMotionButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (sender is not Button button || button.Tag is not string direction) @@ -86,5 +103,31 @@ public partial class MainWindow : Window SidebarDetails.Visibility = collapsed ? Visibility.Collapsed : Visibility.Visible; SidebarCollapsedRail.Visibility = collapsed ? Visibility.Visible : Visibility.Collapsed; SidebarHost.Padding = collapsed ? new Thickness(12) : new Thickness(18, 16, 14, 16); + QueueRealtimeChartLayoutRefresh(); + } + + private void QueueRealtimeChartLayoutRefresh() + { + if (_isRealtimeChartLayoutRefreshQueued) + { + return; + } + + _isRealtimeChartLayoutRefreshQueued = true; + Dispatcher.BeginInvoke(RefreshRealtimeChartLayout, DispatcherPriority.ContextIdle); + } + + private void RefreshRealtimeChartLayout() + { + _isRealtimeChartLayoutRefreshQueued = false; + + if (RealtimeForceChart.ActualWidth <= 0 || RealtimeForceChart.ActualHeight <= 0) + { + return; + } + + RealtimeForceChart.InvalidateMeasure(); + RealtimeForceChart.InvalidateArrange(); + RealtimeForceChart.UpdateLayout(); } }