mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-09 10:46:37 +08:00
动画demo完成
This commit is contained in:
@@ -11,7 +11,33 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public class ShapeDesignerItemViewModel : DesignerItemViewModelBase
|
||||
{
|
||||
public List<PointDesignerItemViewModel> PointDesignerItemViewModels { get; set; }
|
||||
public ShapeDesignerItemViewModel(DrawMode drawMode, List<Point> points) : this(null, drawMode, points)
|
||||
{
|
||||
}
|
||||
|
||||
public ShapeDesignerItemViewModel(IDiagramViewModel root, DrawMode drawMode, List<Point> points) : base(root)
|
||||
{
|
||||
DrawMode = drawMode;
|
||||
ConnectionPoints = points;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private List<Point> _connectionPoints;
|
||||
public List<Point> ConnectionPoints
|
||||
@@ -25,7 +51,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
SetProperty(ref _connectionPoints, value);
|
||||
}
|
||||
}
|
||||
public DrawMode DrawMode { get; set; }
|
||||
public DrawMode DrawMode
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
private bool _showConnectors = false;
|
||||
public new bool ShowConnectors
|
||||
@@ -46,26 +75,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
}
|
||||
|
||||
public SimpleCommand MenuItemCommand { get; private set; }
|
||||
|
||||
public ShapeDesignerItemViewModel(DrawMode drawMode, List<Point> points) : base()
|
||||
public SimpleCommand MenuItemCommand
|
||||
{
|
||||
DrawMode = drawMode;
|
||||
ConnectionPoints = points;
|
||||
|
||||
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);
|
||||
get; private set;
|
||||
}
|
||||
|
||||
private void PointDesignerItemViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
@@ -85,10 +97,10 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
Top = ConnectionPoints.Min(p => p.Y);
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
protected override void Init(IDiagramViewModel root)
|
||||
{
|
||||
MenuItemCommand = new SimpleCommand(Command_Enable, ExecuteMenuItemCommand);
|
||||
base.Init();
|
||||
base.Init(root);
|
||||
|
||||
this.ClearConnectors();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user