Commit 69b2a004 authored by 潘栩锋's avatar 潘栩锋 🚴

优化 机架修正删除多余的点移动功能

parent 45bb6303
......@@ -598,14 +598,6 @@ namespace FLY.Thick.Base.UI
return;
}
break;
case KeyPointsSelectMode.Move:
{
keyPointLine.Move(cpEnd.X, SeriesInfos[0].Datas);
if (selectType == SelectType.Cancel)
keyPointLine.ResetSelected();
}
break;
}
}
......@@ -888,8 +880,6 @@ namespace FLY.Thick.Base.UI
public ObservableCollection<XY> KeyPoints { get; } = new ObservableCollection<XY>();
public int SmoothFactor { get; set; } = 20;
public int SelectedIndex { get; private set; } = -1;
public event PropertyChangedEventHandler PropertyChanged;
......@@ -898,61 +888,34 @@ namespace FLY.Thick.Base.UI
public void Add(double x, IEnumerable<double> orgDatas)
{
ResetSelected();
if (x < 0 || x >= orgDatas.Count())
return;//超出范围
int index = FindIndex(x);
if (index == -1)
{
if (index != -1)
return;
double y = CalY(x, orgDatas);
//没有,可以添加
Insert(x, y);
}
}
public void Remove(double x)
{
ResetSelected();
int index = FindIndex(x);
if (index == -1)
{
if (index != -1)
return;
}
KeyPoints.RemoveAt(index);
}
public void Move(double x, IEnumerable<double> orgDatas)
{
if (SelectedIndex>=0 && SelectedIndex<KeyPoints.Count())
{
if (SelectedIndex - 1 >= 0
&& x <= KeyPoints[SelectedIndex - 1].X)
{
// 移过头了,停!!!!
//换个点
SelectedIndex--;
return;
}
if (SelectedIndex + 1 < KeyPoints.Count()
&& x >= KeyPoints[SelectedIndex + 1].X)
{
// 移过头了,停!!!!
//换个点
SelectedIndex++;
return;
}
double y = CalY(x,orgDatas);
KeyPoints[SelectedIndex] = new XY() { X = x, Y = y };
}
else {
SelectedIndex = FindIndex(x);
}
}
public void Clear() {
ResetSelected();
KeyPoints.Clear();
}
public void ResetSelected() {
SelectedIndex = -1;
}
/// <summary>
/// 计算 位置为x 在 orgDatas中的y
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment