Files
aistudio-wpf-diagram/AIStudio.Wpf.DiagramDesigner/ViewModels/DefaultViewModel/LinkPointDesignerItemViewModel.cs
艾竹 b36bd4b228 XX
2023-03-25 11:59:31 +08:00

42 lines
1.1 KiB
C#

using System;
using System.Windows;
namespace AIStudio.Wpf.DiagramDesigner
{
public class LinkPointDesignerItemViewModel : DesignerItemViewModelBase
{
public LinkPointDesignerItemViewModel(Point location) : this(null, location)
{
}
public LinkPointDesignerItemViewModel(IDiagramViewModel root, Point location) : base(root)
{
Left = Math.Max(0, location.X - ItemWidth / 2);
Top = Math.Max(0, location.Y - ItemHeight / 2);
}
protected override void Init(IDiagramViewModel root, bool initNew)
{
base.Init(root, initNew);
}
protected override void InitNew()
{
this.ClearConnectors();
this.AddConnector(new FullyCreatedConnectorInfo(this, ConnectorOrientation.None, true));
ItemWidth = 5;
ItemHeight = 5;
}
public Point CurrentLocation
{
get
{
return new Point() { X = Left + ItemWidth / 2, Y = Top + ItemHeight / 2 };
}
}
}
}