This commit is contained in:
艾竹
2023-07-23 12:35:18 +08:00
parent b6e095293c
commit e34f7fd5a3
5 changed files with 80 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ using AIStudio.Wpf.DiagramDesigner.Helpers;
namespace AIStudio.Wpf.DiagramDesigner
{
public static class DragAndDropProps
public static class DragAndDropProps
{
#region EnabledForDrag
@@ -31,10 +31,10 @@ namespace AIStudio.Wpf.DiagramDesigner
private static void OnEnabledForDragChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
FrameworkElement fe = (FrameworkElement) d;
FrameworkElement fe = (FrameworkElement)d;
if((bool)e.NewValue)
if ((bool)e.NewValue)
{
fe.PreviewMouseDown += Fe_PreviewMouseDown;
fe.MouseMove += Fe_MouseMove;
@@ -67,10 +67,15 @@ namespace AIStudio.Wpf.DiagramDesigner
static void Fe_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
{
Point? dragStartPoint = GetDragStartPoint((DependencyObject)sender);
if (e.LeftButton != MouseButtonState.Pressed)
dragStartPoint = null;
{
return;
}
Point? dragStartPoint = GetDragStartPoint((DependencyObject)sender);
var point = e.GetPosition((IInputElement)sender);
if (dragStartPoint == point)
return;
if (dragStartPoint.HasValue && ((FrameworkElement)sender).DataContext is ToolBoxData toolBoxData)
{