彩色连接点完成

This commit is contained in:
艾竹
2023-02-01 23:05:56 +08:00
parent 50eab5e091
commit 527dbd98e4
16 changed files with 476 additions and 138 deletions

View File

@@ -82,27 +82,6 @@ namespace AIStudio.Wpf.DiagramDesigner
get; set;
}
private bool _isSelected;
public override bool IsSelected
{
get
{
return _isSelected;
}
set
{
if (SetProperty(ref _isSelected, value))
{
//如果没有文字,失去焦点自动清除
if (_isSelected == false && string.IsNullOrEmpty(Text))
{
Connector.Labels.Remove(this);
}
}
}
}
public SimpleCommand DeleteLabelCommand
{
get; set;
@@ -196,6 +175,11 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
protected override void ClearText()
{
Connector.Labels.Remove(this);
}
private void DeleteLabel(object parameter)
{
if (parameter is ConnectorLabelModel label)

View File

@@ -10,12 +10,12 @@ namespace AIStudio.Wpf.DiagramDesigner
{
public class FullyCreatedConnectorInfo : ConnectorInfoBase
{
public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = 0)
: this(null, dataItem, orientation, isInnerPoint, isPortless, valueTypePoint)
public FullyCreatedConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false)
: this(null, dataItem, orientation, isInnerPoint, isPortless)
{
}
public FullyCreatedConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = 0)
public FullyCreatedConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false)
: base(root, orientation)
{
this.Parent = dataItem;

View File

@@ -7,11 +7,12 @@ namespace AIStudio.Wpf.DiagramDesigner
{
public class LogicalConnectorInfo : FullyCreatedConnectorInfo
{
public LogicalConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = ValueTypePoint.Real) : base(dataItem, orientation, isInnerPoint, isPortless, valueTypePoint)
public LogicalConnectorInfo(DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = ValueTypePoint.Real) : base(dataItem, orientation, isInnerPoint, isPortless)
{
this.ValueTypePoint = valueTypePoint;
}
public LogicalConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = ValueTypePoint.Real) : base(root, dataItem, orientation, isInnerPoint, isPortless, valueTypePoint)
public LogicalConnectorInfo(IDiagramViewModel root, DesignerItemViewModelBase dataItem, ConnectorOrientation orientation, bool isInnerPoint = false, bool isPortless = false, ValueTypePoint valueTypePoint = ValueTypePoint.Real) : base(root, dataItem, orientation, isInnerPoint, isPortless)
{
this.ValueTypePoint = valueTypePoint;
}

View File

@@ -73,55 +73,6 @@ namespace AIStudio.Wpf.DiagramDesigner
get; private set;
}
private bool _isSelected;
[Browsable(false)]
public override bool IsSelected
{
get
{
return _isSelected;
}
set
{
if (SetProperty(ref _isSelected, value))
{
//如果没有文字,失去焦点自动清除
if (_isSelected == false && string.IsNullOrEmpty(Text))
{
ShowText = false;
}
}
}
}
private string _text;
[Browsable(true)]
[CanDo]
public override string Text
{
get
{
var text = _text;
if (FontViewModel.FontCase == FontCase.Upper)
{
return text?.ToUpper();
}
else if (FontViewModel.FontCase == FontCase.Lower)
{
return text?.ToLower();
}
else
{
return text;
}
}
set
{
SetProperty(ref _text, value);
}
}
private bool _isReadOnlyText = false;
public bool IsReadOnlyText
{
@@ -137,8 +88,22 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
//自己定义文本显示,文本框不显示
private bool _customText = false;
public bool CustomText
{
get
{
return _customText;
}
set
{
SetProperty(ref _customText, value);
}
}
private bool _showText;
public virtual bool ShowText
public bool ShowText
{
get
{
@@ -153,6 +118,11 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
protected override void ClearText()
{
ShowText = false;
}
private void ExecuteSelectItemCommand(object param)
{
SelectItem((bool)param, !IsSelected);
@@ -164,7 +134,7 @@ namespace AIStudio.Wpf.DiagramDesigner
{
foreach (var designerItemViewModelBase in Root.SelectedItems.ToList())
{
designerItemViewModelBase._isSelected = false;
designerItemViewModelBase.ClearSelected();
}
}

View File

@@ -146,7 +146,7 @@ namespace AIStudio.Wpf.DiagramDesigner
private bool _isSelected;
[Browsable(false)]
public virtual bool IsSelected
public bool IsSelected
{
get
{
@@ -154,7 +154,14 @@ namespace AIStudio.Wpf.DiagramDesigner
}
set
{
SetProperty(ref _isSelected, value);
if (SetProperty(ref _isSelected, value))
{
//如果没有文字,失去焦点自动清除
if (_isSelected == false && string.IsNullOrEmpty(Text))
{
ClearText();
}
}
}
}
@@ -298,6 +305,16 @@ namespace AIStudio.Wpf.DiagramDesigner
}
protected virtual void ClearText()
{
}
public virtual void ClearSelected()
{
_isSelected = false;
}
public virtual void AddToSelection(bool selected)
{