mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-17 23:16:41 +08:00
49 lines
1.3 KiB
C#
49 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Windows;
|
|
using System.Windows.Controls.Primitives;
|
|
using System.Windows.Input;
|
|
using System.Windows.Media;
|
|
using AIStudio.Wpf.DiagramDesigner.Geometrys;
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner.Controls
|
|
{
|
|
public class BlockDragThumb : DragThumb
|
|
{
|
|
BlockDesignerItemViewModel DesignerItem
|
|
{
|
|
get
|
|
{
|
|
return DataContext as BlockDesignerItemViewModel;
|
|
}
|
|
}
|
|
|
|
private Point? firstPoint;
|
|
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e)
|
|
{
|
|
base.OnPreviewMouseLeftButtonDown(e);
|
|
if (e.LeftButton == MouseButtonState.Pressed && firstPoint == null)
|
|
{
|
|
firstPoint = e.GetPosition(this);
|
|
DesignerItem.BeforeExecute();
|
|
}
|
|
}
|
|
|
|
protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e)
|
|
{
|
|
base.OnPreviewMouseLeftButtonDown(e);
|
|
|
|
if (firstPoint == e.GetPosition(this))
|
|
{
|
|
DesignerItem.EditCommand?.Execute(e.GetPosition(this));
|
|
firstPoint = null;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|