From 4a1fc12c523eca9808ed1481015cfe10b09f8cf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=89=BE=E7=AB=B9?= Date: Mon, 1 May 2023 13:17:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=94=BB=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Converters/ConectorValueConverter.cs | 13 ++++++++++--- .../BaseViewModel/ConnectionViewModel.cs | 18 +++++++++--------- .../Connector/LogicalConnectorInfo.cs | 9 +++++++-- .../BaseViewModel/DesignerItemViewModelBase.cs | 4 ++++ 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/AIStudio.Wpf.DiagramDesigner/Converters/ConectorValueConverter.cs b/AIStudio.Wpf.DiagramDesigner/Converters/ConectorValueConverter.cs index 84c6205..5fab265 100644 --- a/AIStudio.Wpf.DiagramDesigner/Converters/ConectorValueConverter.cs +++ b/AIStudio.Wpf.DiagramDesigner/Converters/ConectorValueConverter.cs @@ -17,7 +17,7 @@ namespace AIStudio.Wpf.DiagramDesigner { if (values[0] is LogicalConnectorInfo logicalConnectorInfo) { - if (logicalConnectorInfo.ErrorCode != Enums.ConnectorErrorCode.None) + if (logicalConnectorInfo.ErrorCode != Enums.ConnectorErrorCode.None) { if (parameter?.ToString() == "ToolTip") { @@ -48,12 +48,19 @@ namespace AIStudio.Wpf.DiagramDesigner if (obj.ContainsKey("Text")) { return obj["Text"].ToString(); - } + } } } else { - return logicalConnectorInfo.ConnectorString; + if (parameter?.ToString() == "ToolTip") + { + return logicalConnectorInfo.ConnectorString; + } + else + { + return "..."; + } } } return null; diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/ConnectionViewModel.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/ConnectionViewModel.cs index fa263c6..56ec027 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/ConnectionViewModel.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/ConnectionViewModel.cs @@ -730,28 +730,28 @@ namespace AIStudio.Wpf.DiagramDesigner SinkConnectorInfo = sink; } - public void SetPathGeneratorParameter(double smoothMargin, double smoothAutoSlope, double orthogonalShapeMargin, double orthogonalGlobalBoundsMargin) + public void SetPathGeneratorParameter(double? smoothMargin, double? smoothAutoSlope, double? orthogonalShapeMargin, double? orthogonalGlobalBoundsMargin) { bool hasChanged = false; - if (SmoothMargin != smoothMargin) + if (smoothMargin != null && SmoothMargin != smoothMargin) { hasChanged = true; - SmoothMargin = smoothMargin; + SmoothMargin = smoothMargin.Value; } - if (SmoothAutoSlope != smoothAutoSlope) + if (smoothAutoSlope != null && SmoothAutoSlope != smoothAutoSlope) { hasChanged = true; - SmoothAutoSlope = smoothAutoSlope; + SmoothAutoSlope = smoothAutoSlope.Value; } - if (OrthogonalShapeMargin != orthogonalShapeMargin) + if (orthogonalShapeMargin != null && OrthogonalShapeMargin != orthogonalShapeMargin) { hasChanged = true; - OrthogonalShapeMargin = orthogonalShapeMargin; + OrthogonalShapeMargin = orthogonalShapeMargin.Value; } - if (OrthogonalGlobalBoundsMargin != orthogonalGlobalBoundsMargin) + if (orthogonalGlobalBoundsMargin != null && OrthogonalGlobalBoundsMargin != orthogonalGlobalBoundsMargin) { hasChanged = true; - OrthogonalGlobalBoundsMargin = orthogonalGlobalBoundsMargin; + OrthogonalGlobalBoundsMargin = orthogonalGlobalBoundsMargin.Value; } if (hasChanged) { diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/Connector/LogicalConnectorInfo.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/Connector/LogicalConnectorInfo.cs index 67de55d..4223d14 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/Connector/LogicalConnectorInfo.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/Connector/LogicalConnectorInfo.cs @@ -109,6 +109,11 @@ namespace AIStudio.Wpf.DiagramDesigner } } + public bool InitValue + { + get; set; + } + public bool ConnectorChanged { get; set; @@ -119,7 +124,7 @@ namespace AIStudio.Wpf.DiagramDesigner if (IsLoaded == false) { return; } switch (e.PropertyName) - { + { case nameof(ConnectorValue): case nameof(ConnectorString): case nameof(ConnectorValueType): @@ -128,7 +133,7 @@ namespace AIStudio.Wpf.DiagramDesigner RaisePropertyChanged(nameof(ConnectorChanged)); break; } - + } public override bool CanAttachTo(FullyCreatedConnectorInfo port) diff --git a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs index 9062a0d..d43b40b 100644 --- a/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs +++ b/AIStudio.Wpf.DiagramDesigner/ViewModels/BaseViewModel/DesignerItemViewModelBase.cs @@ -716,6 +716,10 @@ namespace AIStudio.Wpf.DiagramDesigner public IShape GetShape() => ShapeDefiner(this); + public override string ToString() + { + return $"{Id}-{Name}-{Text}-({Left},{Top},{ItemWidth},{ItemHeight})"; + } #endregion } }