From fd2ec4214c6f8456b957c3545e7d67bcdbbb9985 Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期二, 02 十二月 2025 15:26:33 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override

---
 north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue |   25 +++++++++++++++++++++++--
 1 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
index 8369231..4d4b39b 100644
--- a/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
+++ b/north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
@@ -344,6 +344,10 @@
 
 //鐐瑰嚮灏忕墖
 const handleRectClick = (layoutIndex, rectIndex) => {
+  if (dragging.value) {
+    return;
+  }
+
   focusIndex.value = { layoutIndex, rectIndex };
   emit('rectClicked', layoutIndex, rectIndex);
 };
@@ -536,7 +540,6 @@
   const glassDetail = layout.glassDetails[rectIndex];
   if (glassDetail.isRemain) return;
 
-  dragging.value = true;
   dragRect.value = { layoutIndex, rectIndex };
   dragStartPos.value = {
     x: event.clientX,
@@ -546,7 +549,22 @@
 
 //灏忕墖榧犳爣绉诲姩浜嬩欢
 const handleRectDragging = (event) => {
-  if (!dragging.value || !dragRect.value) return;
+  if (!dragRect.value) return;
+
+  // 濡傛灉杩樻病纭鏄嫋鎷斤紝鍒欏厛鍒ゆ柇鏄惁杈惧埌鎷栨嫿闃堝��(渚嬪5鍍忕礌)
+  if (!dragging.value) {
+    const deltaX = event.clientX - dragStartPos.value.x;
+    const deltaY = event.clientY - dragStartPos.value.y;
+    const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
+
+    // 濡傛灉绉诲姩璺濈灏忎簬闃堝�硷紝鍒欒涓烘槸鐐瑰嚮鑰岄潪鎷栨嫿
+    if (distance < 5) {
+      return;
+    }
+
+    // 杈惧埌闃堝�硷紝纭鏄嫋鎷芥搷浣�
+    dragging.value = true;
+  }
 
   const layoutIndex = dragRect.value.layoutIndex;
   const rectIndex = dragRect.value.rectIndex;
@@ -612,6 +630,9 @@
 
 //灏忕墖榧犳爣鏉惧紑浜嬩欢
 const handleRectDragEnd = () => {
+  dragging.value = false;
+  dragRect.value = null;
+  dragStartPos.value = { x: 0, y: 0 };
   if (dragRect.value) {
     const layoutIndex = dragRect.value.layoutIndex;
     const rectIndex = dragRect.value.rectIndex;

--
Gitblit v1.8.0