From bcfb05f5e7782ef23e4deb1b38a1ca4b4085181a Mon Sep 17 00:00:00 2001
From: cuiqian2004 <cuiqian2004@163.com>
Date: 星期六, 11 十月 2025 17:09:47 +0800
Subject: [PATCH] test

---
 pages/map/js/ctx.js |   65 ++++++++++++++++++++++++--------
 1 files changed, 49 insertions(+), 16 deletions(-)

diff --git a/pages/map/js/ctx.js b/pages/map/js/ctx.js
index 9af2077..7479ccf 100644
--- a/pages/map/js/ctx.js
+++ b/pages/map/js/ctx.js
@@ -2114,11 +2114,11 @@
 				fromY = pt2.y
 			}
 			let strokeWidth = 5
-			let stroke = "#95DE64"
+			let stroke = "#69C0FF"
 
-			if (main_road == 1) {
-				stroke = "#69C0FF"
-			}
+			// if (main_road == 1) {
+			// 	stroke = "#69C0FF"
+			// }
 			const objPath = new fabric.Path(
 				path2, {
 					id: "current_teaching",
@@ -2154,7 +2154,7 @@
 
 			const theta = 20;
 			let headlen = 10;
-			var main_road = 1
+			var main_road = teachingData.main_road || 0
 
 			const len = pos_list.length
 			let fromX = 0,
@@ -2238,10 +2238,11 @@
 					// }
 					path2 += ` L${pt2.x} ${pt2.y}`
 				} else {
-					main_road = pt.main_road
-					if (main_road == 1) {
-						headlen = 15
-					}
+					if (pt.main_road)
+						main_road = pt.main_road
+					// if (main_road == 1) {
+					// 	headlen = 15
+					// }
 					path2 = `M${pt2.x} ${pt2.y}`
 				}
 				fromX = pt2.x
@@ -2252,19 +2253,21 @@
 
 			// console.log("addTeachingPath",path2)
 			// path2 += " Z"
-			let strokeWidth = 2
-			let stroke = "#95DE64"
+			let strokeWidth = 1.5
+			let stroke = "#69C0FF"
 			if (type == "station_teaching") {
 				stroke = "#69C0FF"
 			} else {
 				if (main_road == 1) {
-					stroke = "#69C0FF"
-					if (teachingData.bidirection == 1) {
-						stroke = "#FF00FF"
-					}
-				} else {
+					//stroke = "#69C0FF"
 					if (teachingData.bidirection == 1) {
 						stroke = "#ffaa00"
+					}
+					strokeWidth = 3
+
+				} else {
+					if (teachingData.bidirection == 1) {
+						stroke = "#FF00FF"
 					}
 				}
 			}
@@ -2302,6 +2305,7 @@
 
 			return objPath
 		},
+
 		isObjectFullyContained(outerObj, innerObj) {
 			const outer = outerObj.getBoundingRect(true, true);
 			const inner = innerObj.getBoundingRect(true, true);
@@ -3649,6 +3653,35 @@
 						const teachingMode = item.param
 						_this.showEditTeachingPath(teachingMode)
 
+					} else if (item.method == "update_teaching") {
+						let list = _this.canvas.getObjects() || []
+						list = list.filter((a) => a.eleType == "public_teaching")
+						const id = `public_teaching_${item.param.name}`
+						const curIndex = list.findIndex((a) => a.id == id)
+						if (curIndex > -1) {
+							const obj = list[curIndex]
+
+
+
+							let strokeWidth = 1.5
+							let stroke = "#69C0FF"
+
+							if (item.param.main_road == 1) {
+								//stroke = "#69C0FF"
+								if (item.param.bidirection == 1) {
+									stroke = "#ffaa00"
+								}
+								strokeWidth = 3
+
+							} else {
+								if (item.param.bidirection == 1) {
+									stroke = "#FF00FF"
+								}
+							}
+
+							obj.set({strokeWidth,stroke})
+
+						}
 					} else if (item.method == "set_selectable") {
 						if (item.param)
 							_this.setAllObjectSelectable(true)

--
Gitblit v1.9.1