sfc界面处理完成,还差顺序逻辑控制过程

This commit is contained in:
艾竹
2021-08-01 22:30:12 +08:00
parent 9a0e85e1a9
commit 0b8258003f
50 changed files with 2682 additions and 155 deletions

View File

@@ -23,10 +23,7 @@ namespace Util.DiagramDesigner
{
base.Init();
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Top));
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Bottom));
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Left));
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Right));
InitConnector();
}
protected override void LoadDesignerItemViewModel(IDiagramViewModel parent, SelectableDesignerItemBase designerbase)
@@ -43,7 +40,14 @@ namespace Util.DiagramDesigner
this.ItemWidth = designer.ItemWidth;
this.ItemHeight = designer.ItemHeight;
this.Icon = designer.Icon;
}
protected virtual void InitConnector()
{
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Top));
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Bottom));
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Left));
connectors.Add(new FullyCreatedConnectorInfo(this, ConnectorOrientation.Right));
}
public FullyCreatedConnectorInfo TopConnector
@@ -162,6 +166,7 @@ namespace Util.DiagramDesigner
}
public bool ShowRotate { get; set; } = true;
public bool ShowArrow { get; set; } = true;
private double _left;
[Browsable(true)]
@@ -263,6 +268,11 @@ namespace Util.DiagramDesigner
}
}
/// <summary>
/// 连接点是否可以按偏移自定义
/// </summary>
public bool IsRatioConnector { get; set; }
private ObservableCollection<FullyCreatedConnectorInfo> connectors = new ObservableCollection<FullyCreatedConnectorInfo>();
public IEnumerable<FullyCreatedConnectorInfo> Connectors { get { return connectors; } }
@@ -321,28 +331,40 @@ namespace Util.DiagramDesigner
{
if (Parent.CellHorizontalAlignment == CellHorizontalAlignment.Center)
{
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin + (Parent.GridCellSize.Width > this.ItemWidth ? (Parent.GridCellSize.Width - this.ItemWidth) / 2 : 0);
if (Parent.GridCellSize.Width > this.ItemWidth)
{
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin + (Parent.GridCellSize.Width - this.ItemWidth) / 2;
}
}
else if(Parent.CellHorizontalAlignment == CellHorizontalAlignment.Left)
else if (Parent.CellHorizontalAlignment == CellHorizontalAlignment.Left)
{
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin;
}
else if (Parent.CellHorizontalAlignment == CellHorizontalAlignment.Right)
{
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin + (Parent.GridCellSize.Width > this.ItemWidth ? (Parent.GridCellSize.Width - this.ItemWidth) : 0);
if (Parent.GridCellSize.Width > this.ItemWidth)
{
this.Left = (int)(this.Left / Parent.GridCellSize.Width) * Parent.GridCellSize.Width + Parent.GridMargin + (Parent.GridCellSize.Width - this.ItemWidth);
}
}
if (Parent.CellVerticalAlignment == CellVerticalAlignment.Center)
{
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin + (Parent.GridCellSize.Height > this.ItemHeight ? (Parent.GridCellSize.Height - this.ItemHeight) / 2 : 0);
{
if (Parent.GridCellSize.Height > this.ItemHeight)
{
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin + (Parent.GridCellSize.Height - this.ItemHeight) / 2;
}
}
else if (Parent.CellVerticalAlignment == CellVerticalAlignment.Top)
{
{
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin;
}
else if (Parent.CellVerticalAlignment == CellVerticalAlignment.Bottom)
{
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin + (Parent.GridCellSize.Height > this.ItemHeight ? (Parent.GridCellSize.Height - this.ItemHeight) : 0);
{
if (Parent.GridCellSize.Height > this.ItemHeight)
{
this.Top = (int)(this.Top / Parent.GridCellSize.Height) * Parent.GridCellSize.Height + Parent.GridMargin + (Parent.GridCellSize.Height - this.ItemHeight);
}
}
}
}

View File

@@ -82,6 +82,7 @@ namespace Util.DiagramDesigner
protected override void Init()
{
ShowRotate = false;
ShowArrow = false;
AddInputCommand = new SimpleCommand(para => ExecuteAddInput(para));
AddOutputCommand = new SimpleCommand(para => ExecuteAddOutput(para));
@@ -217,7 +218,7 @@ namespace Util.DiagramDesigner
Input.Add(Input.Count, connector);
for (int i = 0; i < Input.Values.Count; i++)
{
Input[i].YRatio = (i + 1.0) / (Input.Values.Count + 1.0) - connector.ConnectorHeight / 2 / connector.DataItem.ItemHeight;
Input[i].YRatio = (i + 1.0) / (Input.Values.Count + 1.0);
}
AddConnector(connector);
}
@@ -229,7 +230,7 @@ namespace Util.DiagramDesigner
Output.Add(Output.Count, connector);
for (int i = 0; i < Output.Values.Count; i++)
{
Output[i].YRatio = (i + 1.0) / (Output.Values.Count + 1.0) - connector.ConnectorHeight / 2 / connector.DataItem.ItemHeight;
Output[i].YRatio = (i + 1.0) / (Output.Values.Count + 1.0);
}
AddConnector(connector);
}

View File

@@ -34,8 +34,8 @@ namespace Util.DiagramDesigner
protected virtual void Init()
{
ColorViewModel = CopyHelper.Mapper(_service.ColorViewModel);
FontViewModel = CopyHelper.Mapper<FontViewModel, IFontViewModel>(_service.FontViewModel);
ColorViewModel = _service.CopyDefaultColorViewModel();
FontViewModel = _service.CopyDefaultFontViewModel();
LockObjectViewModel = new LockObjectViewModel();
SelectItemCommand = new SimpleCommand(ExecuteSelectItemCommand);