ai优化10

This commit is contained in:
tanglong 2026-05-13 12:04:22 +08:00
parent f6c632607d
commit b1ce0f4f62
2 changed files with 13 additions and 2 deletions

View File

@ -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

View File

@ -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;