From 64e0880d2d81ce2b3f0e366b1537c5efe2f2c4ea Mon Sep 17 00:00:00 2001
From: 826220679@qq.com <826220679@qq.com>
Date: 星期日, 21 十二月 2025 20:49:24 +0800
Subject: [PATCH] 需改优化了绘制往返路径

---
 src/zhuye/Shouye.java |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/src/zhuye/Shouye.java b/src/zhuye/Shouye.java
index 22f8fc6..97dddac 100644
--- a/src/zhuye/Shouye.java
+++ b/src/zhuye/Shouye.java
@@ -2125,7 +2125,12 @@
 			updateStopButtonIcon();
 		}
 		if (statusLabel != null) {
-			statusLabel.setText(storedStatusBeforeDrawing != null ? storedStatusBeforeDrawing : "寰呮満");
+			// 濡傛灉鏄線杩旇矾寰勭粯鍒讹紝閫�鍑烘椂鎭㈠涓�"寰呮満"
+			if (returnPathDrawer != null && returnPathDrawer.isActive()) {
+				statusLabel.setText("寰呮満");
+			} else {
+				statusLabel.setText(storedStatusBeforeDrawing != null ? storedStatusBeforeDrawing : "寰呮満");
+			}
 		}
 		storedStatusBeforeDrawing = null;
 	}
@@ -2437,6 +2442,12 @@
 		mapRenderer.setHandheldMowerIconActive(active);
 	}
 
+	public void setStatusLabelText(String text) {
+		if (statusLabel != null) {
+			statusLabel.setText(text);
+		}
+	}
+
 	public boolean startMowerBoundaryCapture() {
 		if (mapRenderer == null) {
 			return false;
@@ -3080,7 +3091,11 @@
 		if (drawingControlModeActive) {
 			updateDrawingControlButtonLabels();
 			if (statusLabel != null) {
-				statusLabel.setText(paused ? "缁樺埗鏆傚仠" : "缁樺埗涓�");
+				if (returnPathDrawer != null && returnPathDrawer.isActive()) {
+					statusLabel.setText("姝e湪缁樺埗寰�杩旇矾寰�");
+				} else {
+					statusLabel.setText(paused ? "缁樺埗鏆傚仠" : "缁樺埗涓�");
+				}
 			}
 		}
 	}
@@ -3106,7 +3121,9 @@
 		
 		// 鏄剧ず"姝e湪缁樺埗杈圭晫"鎻愮ず
 		if (drawingBoundaryLabel != null) {
-			drawingBoundaryLabel.setVisible(true);
+			// 濡傛灉鏄線杩旇矾寰勭粯鍒讹紝涓嶆樉绀烘鏍囩锛堢姸鎬佹爮宸叉樉绀�"姝e湪缁樺埗寰�杩旇矾寰�"锛�
+			boolean isReturnPathDrawing = returnPathDrawer != null && returnPathDrawer.isActive();
+			drawingBoundaryLabel.setVisible(!isReturnPathDrawing);
 		}
 
 		boolean enableCircleGuidance = drawingShape != null
@@ -4149,13 +4166,14 @@
     /**
      * 鍚姩寰�杩旇矾寰勭粯鍒�
      * @param finishCallback 瀹屾垚缁樺埗鏃剁殑鍥炶皟
+     * @param isHandheld 鏄惁浣跨敤鎵嬫寔璁惧妯″紡
      * @return 鏄惁鎴愬姛鍚姩
      */
-    public boolean startReturnPathDrawing(Runnable finishCallback) {
+    public boolean startReturnPathDrawing(Runnable finishCallback, boolean isHandheld) {
         if (returnPathDrawer == null) {
             return false;
         }
-        return returnPathDrawer.start(finishCallback);
+        return returnPathDrawer.start(finishCallback, isHandheld);
     }
     
     /**
@@ -4223,12 +4241,12 @@
         
         // 鍒涘缓鎴栨樉绀鸿繑鍥炴寜閽�
         if (pathPreviewReturnButton == null) {
-            pathPreviewReturnButton = publicway.buttonset.createStyledButton("杩斿洖", null);
-            pathPreviewReturnButton.setToolTipText("杩斿洖缁樺埗椤甸潰");
-            pathPreviewReturnButton.addActionListener(e -> {
+            // 浣跨敤 Fanhuibutton 鍒涘缓杩斿洖鎸夐挳
+            pathPreviewReturnButton = publicway.Fanhuibutton.createReturnButton(e -> {
                 // 鍋滄棰勮
                 stopReturnPathPreview();
             });
+            pathPreviewReturnButton.setToolTipText("杩斿洖缁樺埗椤甸潰");
         }
         
         // 闅愯棌鍏朵粬鎮诞鎸夐挳

--
Gitblit v1.10.0