diff --git a/Wpf_AiSportsMicrospace/Common/SportOperate.cs b/Wpf_AiSportsMicrospace/Common/SportOperate.cs
index c8e78d0..b03c187 100644
--- a/Wpf_AiSportsMicrospace/Common/SportOperate.cs
+++ b/Wpf_AiSportsMicrospace/Common/SportOperate.cs
@@ -229,7 +229,7 @@ namespace Wpf_AiSportsMicrospace.Common
if (k.Name != "right_ankle" && k.Name != "left_ankle")
continue;
- double x = k.X;
+ double x = 1920 - k.X;
double y = k.Y;
if (Math.Abs(x - cx) <= halfW &&
diff --git a/Wpf_AiSportsMicrospace/Common/Utils.cs b/Wpf_AiSportsMicrospace/Common/Utils.cs
index 014089b..ea5781e 100644
--- a/Wpf_AiSportsMicrospace/Common/Utils.cs
+++ b/Wpf_AiSportsMicrospace/Common/Utils.cs
@@ -367,7 +367,7 @@ namespace Wpf_AiSportsMicrospace.Common
{
cfg.Point1, cfg.Point2, cfg.Point3,
cfg.Point4, cfg.Point5, cfg.Point6,
- cfg.Point7, cfg.Point8, cfg.Point9, cfg.Point10
+ cfg.Point7, cfg.Point8, cfg.Point9
};
// 取前 pointCount 个点
diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml
index 7cfde0b..84e0cea 100644
--- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml
+++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml
@@ -1,57 +1,154 @@
-
+ mc:Ignorable="d"
+ d:DesignHeight="900"
+ d:DesignWidth="1920">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs
index 4d2df00..21d03ca 100644
--- a/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs
+++ b/Wpf_AiSportsMicrospace/MyUserControl/CoverFlowControl.xaml.cs
@@ -1,21 +1,10 @@
-using System;
-using System.Collections.Generic;
+using System;
using System.Collections.ObjectModel;
-using System.ComponentModel;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
using System.Windows.Threading;
namespace Wpf_AiSportsMicrospace.MyUserControl
@@ -25,9 +14,16 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
///
public partial class CoverFlowControl : UserControl
{// 新增事件:进度条完成
- public event Action ProgressCompleted;
+ public event Action? ProgressCompleted;
public ObservableCollection Images { get; set; } = new ObservableCollection();
private int _selectedIndex = 0;
+ private bool _isAnimating;
+ private int _pendingSlideSteps;
+
+ private const double CardWidth = 346;
+ private const double CardHeight = 534;
+ private const double CardGap = 30; // 卡片之间水平间距
+ private const double SlideDurationMs = 420; // 动画时长
public int SelectedIndex
{
@@ -40,10 +36,8 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
else if (value >= Images.Count) _selectedIndex = 0;
else _selectedIndex = value;
- for (int i = 0; i < Images.Count; i++)
- Images[i].IsSelected = i == _selectedIndex;
-
- UpdateLayoutWithAnimation();
+ UpdateSelectionFlags();
+ RefreshCards(instant: true);
// 启动进度条动画
//var current = Images[_selectedIndex];
@@ -56,7 +50,7 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
{
InitializeComponent();
DataContext = this;
- Loaded += (s, e) => UpdateLayoutWithAnimation(true);
+ Loaded += CoverFlowControl_Loaded;
//var timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(5) };
//timer.Tick += (s, e) =>
@@ -68,9 +62,21 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
//};
//timer.Start();
}
- private EventHandler _renderHandler;
+ private EventHandler? _renderHandler;
- private CoverFlowItem _currentItem;
+ private CoverFlowItem? _currentItem;
+
+ private void CoverFlowControl_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (Images.Count > 0)
+ {
+ UpdateSelectionFlags();
+ RefreshCards(instant: true);
+ }
+
+ CarouselCanvas.Focus();
+ Keyboard.Focus(CarouselCanvas);
+ }
///
/// 针对当前选中项启动进度条动画
@@ -104,25 +110,11 @@ namespace Wpf_AiSportsMicrospace.MyUserControl
_currentItem = item;
item.Progress = 0;
- var container = ItemsHost.ItemContainerGenerator.ContainerFromItem(item) as ContentPresenter;
- if (container == null) return;
-
- var canvas = FindVisualChild