mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-11 20:19:26 +08:00
工具栏整理
This commit is contained in:
@@ -24,20 +24,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
ItemWidth = ConnectionPoints.Max(p => p.X) - ConnectionPoints.Min(p => p.X);
|
||||
ItemHeight = ConnectionPoints.Max(p => p.Y) - ConnectionPoints.Min(p => p.Y);
|
||||
Left = ConnectionPoints.Min(p => p.X);
|
||||
Top = ConnectionPoints.Min(p => p.Y);
|
||||
|
||||
PointDesignerItemViewModels = new List<PointDesignerItemViewModel>();
|
||||
ConnectionPoints.ForEach((Action<Point>)(p => {
|
||||
var item = new PointDesignerItemViewModel(p);
|
||||
PointDesignerItemViewModels.Add((PointDesignerItemViewModel)item);
|
||||
}));
|
||||
|
||||
PointDesignerItemViewModels.ForEach(p => p.PropertyChanged += PointDesignerItemViewModel_PropertyChanged);
|
||||
}
|
||||
|
||||
public List<PointDesignerItemViewModel> PointDesignerItemViewModels
|
||||
{
|
||||
get; set;
|
||||
Top = ConnectionPoints.Min(p => p.Y);
|
||||
}
|
||||
|
||||
private List<Point> _connectionPoints;
|
||||
@@ -68,10 +55,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
if (SetProperty(ref _showConnectors, value))
|
||||
{
|
||||
foreach (var connector in PointDesignerItemViewModels)
|
||||
{
|
||||
connector.ShowConnectors = value;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,17 +65,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private void PointDesignerItemViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(Left) || e.PropertyName == nameof(Top))
|
||||
{
|
||||
UpdatePoints();
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdatePoints()
|
||||
{
|
||||
ConnectionPoints = PointDesignerItemViewModels.Select(p => p.CurrentLocation).ToList();
|
||||
ItemWidth = ConnectionPoints.Max(p => p.X) - ConnectionPoints.Min(p => p.X);
|
||||
ItemHeight = ConnectionPoints.Max(p => p.Y) - ConnectionPoints.Min(p => p.Y);
|
||||
Left = ConnectionPoints.Min(p => p.X);
|
||||
|
||||
Reference in New Issue
Block a user