This commit is contained in:
艾竹
2023-06-15 22:44:12 +08:00
parent 207523eb16
commit 1dd09a2240
4 changed files with 65 additions and 14 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Controls;
@@ -146,11 +147,21 @@ namespace AIStudio.Wpf.DiagramDesigner
var currentPoint = e.GetPosition(this);
if (Math.Sqrt(Math.Pow(firstPoint.Value.X - currentPoint.X, 2) + Math.Pow(firstPoint.Value.Y - currentPoint.Y, 2)) > 5)
{
firstPoint = null;
if (Info?.Children?.Count > 0)
{
var borders = VisualHelper.FindVisualChildren<BlockBorder>(this);
BlockBorder innerblock = null;
BlockDesignerItemViewModel dragObject = null;
Point dragOffset = new Point();
foreach (var border in borders)
{
var itemsContainer = VisualHelper.TryFindParent<ItemsContainer>(border);
if (this != itemsContainer)
{
continue;
}
var point = border.TransformToAncestor(this).Transform(new Point(0, 0));
var rect = new Rect(point.X, point.Y, border.ActualWidth, border.ActualHeight);
if (rect.Contains(currentPoint))
@@ -167,10 +178,10 @@ namespace AIStudio.Wpf.DiagramDesigner
if (canvas != null)
{
canvas.SourceItemsContainer = this;
e.Handled = true;
}
}
}
firstPoint = null;
}
}
}
@@ -179,7 +190,6 @@ namespace AIStudio.Wpf.DiagramDesigner
base.OnMouseUp(e);
firstPoint = null;
DragObject = null;
}
public ConnectorOrientation Orientation