using System; using System.Windows; namespace AIStudio.Wpf.DiagramDesigner { public class PointDesignerItemViewModel : DesignerItemViewModelBase { public PointDesignerItemViewModel(Point location) : this(null, location) { } public PointDesignerItemViewModel(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() { ItemWidth = 5; ItemHeight = 5; this.ClearConnectors(); this.AddConnector(new FullyCreatedConnectorInfo(this, ConnectorOrientation.None, true)); } private bool _showConnectors = false; public new bool ShowConnectors { get { return _showConnectors; } set { SetProperty(ref _showConnectors, value); } } public Point CurrentLocation { get { return new Point() { X = Left + ItemWidth / 2, Y = Top + ItemHeight / 2 }; } } } }