From b099ab8b7c83dc957bd9777a0bb90c1d8202056b Mon Sep 17 00:00:00 2001
From: chenluhua1980 <Chenluhua@qq.com>
Date: 星期一, 09 二月 2026 13:40:17 +0800
Subject: [PATCH] 1.点一下Port时,连接线重新计算后有重叠。增加防抖功能
---
SourceCode/Bond/Servo/EqsGraphWnd.cpp | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/SourceCode/Bond/Servo/EqsGraphWnd.cpp b/SourceCode/Bond/Servo/EqsGraphWnd.cpp
index ebd4a08..1a5f474 100644
--- a/SourceCode/Bond/Servo/EqsGraphWnd.cpp
+++ b/SourceCode/Bond/Servo/EqsGraphWnd.cpp
@@ -1464,6 +1464,8 @@
GetItemRect(m_pCurItem, &rcItem);
if (::GetCapture() == NULL) {
+ const int kDragThreshold = 3; // debounce: click should not trigger line recalculation
+ bool bDragging = false;
SetCapture(m_hWnd);
ASSERT(m_hWnd == GetCapture());
AfxLockTempMaps();
@@ -1479,6 +1481,14 @@
case WM_MOUSEMOVE:
ptNew = msg.pt;
::ScreenToClient(m_hWnd, &ptNew);
+ if (!bDragging) {
+ if (abs(ptNew.x - pt.x) >= kDragThreshold || abs(ptNew.y - pt.y) >= kDragThreshold) {
+ bDragging = true;
+ }
+ else {
+ break;
+ }
+ }
rcNewItem.left = rcItem.left + (ptNew.x - pt.x);
rcNewItem.right = rcItem.right + (ptNew.x - pt.x);
rcNewItem.top = rcItem.top + (ptNew.y - pt.y);
@@ -1494,6 +1504,10 @@
case WM_LBUTTONUP:
ptNew = msg.pt;
::ScreenToClient(m_hWnd, &ptNew);
+ if (!bDragging) {
+ ReleaseCapture();
+ goto ExitLoop;
+ }
m_pCurItem->rect.left = m_nMagneticLinVer > 0 ? m_nMagneticLinVer : (rcItem.left + (ptNew.x - pt.x) + m_nOffsetX);
m_pCurItem->rect.right = m_pCurItem->rect.left + (rcItem.right - rcItem.left);
m_pCurItem->rect.top = m_nMagneticLinHoz > 0 ? m_nMagneticLinHoz : (rcItem.top + (ptNew.y - pt.y) + m_nOffsetY);
--
Gitblit v1.9.3