bill 2 年之前
父节点
当前提交
e09bc19936
共有 1 个文件被更改,包括 16 次插入5 次删除
  1. 16 5
      src/views/graphic/geos/road.vue

+ 16 - 5
src/views/graphic/geos/road.vue

@@ -3,7 +3,11 @@
     <GraphicAction class="full-action">
       <ui-icon type="lock" ctrl @click="clickHandlerFactory(VectorEvents.UnLock)()" />
     </GraphicAction>
-    <GeoTeleport :menus="menus" class="geo-teleport-use" />
+    <GeoTeleport
+      :menus="menus"
+      class="geo-teleport-use"
+      :active="menus.find((menu) => menu.key === selectKey)"
+    />
   </div>
 </template>
 
@@ -23,10 +27,17 @@ const vector = computed(
     dataService.getRoad(props.geo.vectorId) ||
     dataService.getCurveRoad(props.geo.vectorId)
 );
-const clickHandlerFactory = (key) => {
+
+const selectKey = ref("");
+const clickHandlerFactory = (key, isEE = false) => {
   return () => {
+    if (isEE) {
+      if (selectKey.value === key) {
+        key = null;
+      }
+    }
+    selectKey.value = key;
     drawRef.value.uiControl.updateVectorForSelectUI(key);
-    console.log(vector);
   };
 };
 
@@ -52,13 +63,13 @@ const menus = ref([
     key: VectorEvents.AddLane,
     icon: "lane_a",
     text: "加车道",
-    onClick: clickHandlerFactory(VectorEvents.AddLane),
+    onClick: clickHandlerFactory(VectorEvents.AddLane, true),
   },
   {
     key: VectorEvents.DelLane,
     icon: "lane_d",
     text: "减车道",
-    onClick: clickHandlerFactory(VectorEvents.DelLane),
+    onClick: clickHandlerFactory(VectorEvents.DelLane, true),
   },
   ...appendMenus,
   {