2021-07-23 09:42:22 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
2022-10-28 22:45:39 +08:00
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class LinkPointDesignerItemViewModel : DesignerItemViewModelBase
|
|
|
|
|
|
{
|
2023-01-27 14:54:03 +08:00
|
|
|
|
public LinkPointDesignerItemViewModel(Point location) : this(null, location)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
2023-01-27 14:54:03 +08:00
|
|
|
|
|
2021-07-23 09:42:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-27 14:54:03 +08:00
|
|
|
|
public LinkPointDesignerItemViewModel(IDiagramViewModel root, Point location) : base(root)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
Left = Math.Max(0, location.X - ItemWidth / 2);
|
|
|
|
|
|
Top = Math.Max(0, location.Y - ItemHeight / 2);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-01-27 14:54:03 +08:00
|
|
|
|
protected override void Init(IDiagramViewModel root)
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
2023-01-27 14:54:03 +08:00
|
|
|
|
base.Init(root);
|
2021-07-23 09:42:22 +08:00
|
|
|
|
|
|
|
|
|
|
this.ClearConnectors();
|
|
|
|
|
|
this.AddConnector(new FullyCreatedConnectorInfo(this, ConnectorOrientation.None, true));
|
2023-01-24 17:53:04 +08:00
|
|
|
|
|
2021-07-23 09:42:22 +08:00
|
|
|
|
ItemWidth = 5;
|
|
|
|
|
|
ItemHeight = 5;
|
|
|
|
|
|
}
|
2023-01-27 14:54:03 +08:00
|
|
|
|
|
|
|
|
|
|
public Point CurrentLocation
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return new Point() { X = Left + ItemWidth / 2, Y = Top + ItemHeight / 2 };
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-23 09:42:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|