From 4c36933b76a032bab838ed87f0780ed17af2b24a Mon Sep 17 00:00:00 2001 From: akwkevin Date: Mon, 3 Feb 2025 19:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=80=E7=89=88=E7=BB=88=E7=A8=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PathGenerators/PathGenerators.Corner.cs | 4 +++- .../UserControls/ConnectorContainer.xaml.cs | 11 +++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs index af4d898..03df164 100644 --- a/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs +++ b/AIStudio.Wpf.DiagramDesigner/PathGenerators/PathGenerators.Corner.cs @@ -579,7 +579,9 @@ namespace AIStudio.Wpf.DiagramDesigner n1 = rect.BottomLeft; n2 = rect.BottomRight; break; default: - throw new Exception("No neighour corners found!"); + //throw new Exception("No neighour corners found!"); + n1 = rect.TopLeft; n2 = rect.BottomLeft;//ToDo + break; } } diff --git a/AIStudio.Wpf.DiagramDesigner/UserControls/ConnectorContainer.xaml.cs b/AIStudio.Wpf.DiagramDesigner/UserControls/ConnectorContainer.xaml.cs index 7210616..ffb1e98 100644 --- a/AIStudio.Wpf.DiagramDesigner/UserControls/ConnectorContainer.xaml.cs +++ b/AIStudio.Wpf.DiagramDesigner/UserControls/ConnectorContainer.xaml.cs @@ -80,11 +80,14 @@ namespace AIStudio.Wpf.DiagramDesigner { if (sender is FullyCreatedConnectorInfo vm) { - var connector = ItemContainerGenerator.ContainerFromItem(vm) as ContentPresenter; - if (connector != null) + if (e.PropertyName == "XRatio" || e.PropertyName == "YRatio") { - Canvas.SetLeft(connector, vm.DataItem.GetItemWidth() * vm.XRatio - vm.ConnectorWidth / 2); - Canvas.SetTop(connector, vm.DataItem.GetItemHeight() * vm.YRatio - vm.ConnectorHeight / 2); + var connector = ItemContainerGenerator.ContainerFromItem(vm) as ContentPresenter; + if (connector != null) + { + Canvas.SetLeft(connector, vm.DataItem.GetItemWidth() * vm.XRatio - vm.ConnectorWidth / 2); + Canvas.SetTop(connector, vm.DataItem.GetItemHeight() * vm.YRatio - vm.ConnectorHeight / 2); + } } } }