diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs index 8461878..4083a24 100644 --- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs +++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs @@ -23,7 +23,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl private const double CardWidth = 368; private const double CardHeight = 534; private const double CardGap = 30; // 卡片之间水平间距 - private const double SlideDurationMs = 260; // 动画时长 + private const double SlideDurationMs = 130; // 动画时长 private const double ProgressDurationMs = 2600; public int SelectedIndex diff --git a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs index 8bf0ded..0bb7c25 100644 --- a/Wpf_AiSportsMicrospace/Views/Home.xaml.cs +++ b/Wpf_AiSportsMicrospace/Views/Home.xaml.cs @@ -33,8 +33,9 @@ namespace Wpf_AiSportsMicrospace private Main _mainWin => Application.Current.MainWindow as Main; private WavingAction _lastGestureAction = WavingAction.None; private DateTime _lastMenuSlideTime = DateTime.MinValue; + private bool _menuWaveConsumed; private bool _isNavigating; - private const int MenuSlideCooldownMs = 300; + private const int MenuSlideCooldownMs = 150; public Home() { @@ -105,6 +106,7 @@ namespace Wpf_AiSportsMicrospace Utils.PreloadGifs(); IsGestureActive = true; _isNavigating = false; + _menuWaveConsumed = false; } private void Home_Unloaded(object sender, RoutedEventArgs e) { @@ -125,19 +127,27 @@ namespace Wpf_AiSportsMicrospace switch (wavingaction) { case WavingAction.LeftWave: // 左手挥动 + if (_menuWaveConsumed) + return; + if ((now - _lastMenuSlideTime).TotalMilliseconds < MenuSlideCooldownMs) return; _lastMenuSlideTime = now; + _menuWaveConsumed = true; _lastGestureAction = wavingaction; Dispatcher.BeginInvoke(() => coverFlow.SlideRight(), DispatcherPriority.Input); break; case WavingAction.RightWave: // 右手挥动 + if (_menuWaveConsumed) + return; + if ((now - _lastMenuSlideTime).TotalMilliseconds < MenuSlideCooldownMs) return; _lastMenuSlideTime = now; + _menuWaveConsumed = true; _lastGestureAction = wavingaction; Dispatcher.BeginInvoke(() => coverFlow.SlideLeft(), DispatcherPriority.Input); break; @@ -165,6 +175,7 @@ namespace Wpf_AiSportsMicrospace if (_lastGestureAction == WavingAction.None) return; + _menuWaveConsumed = false; _lastGestureAction = WavingAction.None; Dispatcher.BeginInvoke(() => coverFlow.CancelSelectedProgress(), DispatcherPriority.Background); break;