mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-09 10:46:37 +08:00
整理序列化
This commit is contained in:
@@ -4,43 +4,29 @@ using SvgPathProperties;
|
||||
|
||||
namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
public class ConnectorLabelModel : ConnectorPoint, ISelectable
|
||||
public class ConnectorLabelModel : ConnectorPointModel, ISelectable
|
||||
{
|
||||
public ConnectorLabelModel(ConnectorViewModel parent, string content, double? distance = null, PointBase? offset = null)
|
||||
public ConnectorLabelModel(ConnectorViewModel connector, string content, double? distance = null, PointBase? offset = null)
|
||||
{
|
||||
Parent = parent;
|
||||
Parent = connector;
|
||||
Text = content;
|
||||
Distance = distance;
|
||||
Offset = offset ?? new PointBase();
|
||||
FontViewModel = Parent.FontViewModel;
|
||||
ColorViewModel = Parent.ColorViewModel;
|
||||
Offset = offset ?? new PointBase();
|
||||
}
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
DeleteLabelCommand = new SimpleCommand(DeleteLabel);
|
||||
}
|
||||
|
||||
public ConnectorViewModel Parent
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public bool IsHitTestVisible
|
||||
#region 属性
|
||||
public ConnectorViewModel Connector
|
||||
{
|
||||
get
|
||||
{
|
||||
return Parent.IsHitTestVisible;
|
||||
}
|
||||
}
|
||||
|
||||
private string _text;
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
set
|
||||
{
|
||||
SetProperty(ref _text, value);
|
||||
return Parent as ConnectorViewModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +45,8 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
get; set;
|
||||
}
|
||||
|
||||
private bool _isSelected;
|
||||
public bool IsSelected
|
||||
//private bool _isSelected;
|
||||
public override bool IsSelected
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -73,7 +59,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
//如果没有文字,失去焦点自动清除
|
||||
if (_isSelected == false && string.IsNullOrEmpty(Text))
|
||||
{
|
||||
Parent.Labels.Remove(this);
|
||||
Connector.Labels.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +70,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private bool updating = false;
|
||||
|
||||
@@ -120,7 +107,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
}
|
||||
else
|
||||
{
|
||||
length = totalLength * (Parent.Labels.IndexOf(this) + 1) / (Parent.Labels.Count + 1);
|
||||
length = totalLength * (Connector.Labels.IndexOf(this) + 1) / (Connector.Labels.Count + 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -153,9 +140,9 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
Offset += new VectorBase(0, newvalue - oldvalue);
|
||||
}
|
||||
|
||||
public void AddToSelection(bool selected)
|
||||
public override void AddToSelection(bool selected)
|
||||
{
|
||||
foreach (var item in Parent.Labels.ToList())
|
||||
foreach (var item in Connector.Labels.ToList())
|
||||
item.IsSelected = false;
|
||||
|
||||
if (selected == true)
|
||||
@@ -168,7 +155,7 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
{
|
||||
if (parameter is ConnectorLabelModel label)
|
||||
{
|
||||
Parent.Labels.Remove(label);
|
||||
Connector.Labels.Remove(label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user