From 4697fb46646c8faa1e94c3f0791be576020e601f Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 10 Jan 2026 17:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=92=A4=E9=94=80=E6=96=B0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainWindow_cs/MW_FloatingBarIcons.cs | 74 +++++++------------ .../SettingsViews/SettingsWindow.xaml.cs | 6 -- 2 files changed, 28 insertions(+), 52 deletions(-) diff --git a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs index 5dd22193..3ea441e9 100644 --- a/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs +++ b/Ink Canvas/MainWindow_cs/MW_FloatingBarIcons.cs @@ -1,6 +1,4 @@ using Ink_Canvas.Helpers; -using Ink_Canvas.Windows; -using Ink_Canvas.Windows.SettingsViews; using iNKORE.UI.WPF.Modern; using System; using System.Diagnostics; @@ -2872,67 +2870,51 @@ namespace Ink_Canvas } private bool isOpeningOrHidingSettingsPane; + private bool wasNoFocusModeBeforeSettings; + private bool userChangedNoFocusModeInSettings; private void BtnSettings_Click(object sender, RoutedEventArgs e) { - if (isOpeningOrHidingSettingsPane) return; - HideSubPanels(); + if (BorderSettings.Visibility == Visibility.Visible) { - var settingsWindow = new SettingsWindow(); - settingsWindow.Owner = this; - settingsWindow.ShowDialog(); + HideSubPanels(); } - } - - /// - /// 显示老设置面板 - /// - public void ShowOldSettingsPanel() - { - if (isOpeningOrHidingSettingsPane) return; - HideSubPanels(); - - // 关闭新设置窗口 - foreach (Window window in Application.Current.Windows) + else { - if (window is SettingsWindow) - { - window.Close(); - break; - } - } - - // 显示老设置面板 - if (BorderSettings.Visibility != Visibility.Visible) - { - isOpeningOrHidingSettingsPane = true; BorderSettings.Visibility = Visibility.Visible; - BorderSettingsMask.Visibility = Visibility.Visible; + wasNoFocusModeBeforeSettings = Settings.Advanced.IsNoFocusMode; + userChangedNoFocusModeInSettings = false; // 重置用户修改标志 + if (wasNoFocusModeBeforeSettings) + { + isTemporarilyDisablingNoFocusMode = true; + ApplyNoFocusMode(); + } + + // 设置蒙版为可点击,并添加半透明背景 BorderSettingsMask.IsHitTestVisible = true; - BorderSettingsMask.Background = new SolidColorBrush(Color.FromArgb(128, 0, 0, 0)); - - // 设置初始位置 - BorderSettings.RenderTransform = new TranslateTransform(490, 0); - + BorderSettingsMask.Background = new SolidColorBrush(Color.FromArgb(1, 0, 0, 0)); + SettingsPanelScrollViewer.ScrollToTop(); var sb = new Storyboard(); + + // 滑动动画 var slideAnimation = new DoubleAnimation { - From = 490, + From = BorderSettings.RenderTransform.Value.OffsetX - 490, // 滑动距离 To = 0, Duration = TimeSpan.FromSeconds(0.6), EasingFunction = new CubicEase { EasingMode = EasingMode.EaseOut } }; Storyboard.SetTargetProperty(slideAnimation, new PropertyPath("(UIElement.RenderTransform).(TranslateTransform.X)")); - Storyboard.SetTarget(slideAnimation, BorderSettings); - + sb.Children.Add(slideAnimation); - sb.Completed += (s, _) => - { - isOpeningOrHidingSettingsPane = false; - }; - - sb.Begin(); + + sb.Completed += (s, _) => { isOpeningOrHidingSettingsPane = false; }; + + BorderSettings.RenderTransform = new TranslateTransform(); + + isOpeningOrHidingSettingsPane = true; + sb.Begin(BorderSettings); } } @@ -4016,4 +3998,4 @@ namespace Ink_Canvas } } -} +} \ No newline at end of file diff --git a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs index c66b303b..67ec7f3d 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsWindow.xaml.cs @@ -1232,12 +1232,6 @@ namespace Ink_Canvas.Windows { // 关闭新设置窗口 Close(); - - // 调用主窗口的显示老设置面板方法 - if (_mainWindow != null) - { - _mainWindow.ShowOldSettingsPanel(); - } } private void ToggleSwitch_Click(object sender, MouseButtonEventArgs e)