bill 8 月之前
父节点
当前提交
3400a993fa
共有 1 个文件被更改,包括 10 次插入11 次删除
  1. 10 11
      src/views/guide/path/edit-path.vue

+ 10 - 11
src/views/guide/path/edit-path.vue

@@ -1,7 +1,7 @@
 <template>
   <Teleport to="#layout-app">
     <RightFillPano class="edit-path-point">
-      <div v-show="!~activePointNdx" :class="{ disable: !complete }">
+      <div v-show="!~activePointNdx" :class="{ disable: !data.points.length }">
         <ui-group
           :title="`${isTemploraryID(data.id) ? '创建' : '编辑'}路线`"
           borderBottom
@@ -117,7 +117,7 @@
           {{ isScenePathPlayIng ? "停止" : "" }} 预览路径
         </Button>
       </div>
-      <div v-if="~activePointNdx" :class="{ disable: !complete }">
+      <div v-if="~activePointNdx">
         <ui-group title="编辑点" borderBottom>
           <ui-group-option>描述:</ui-group-option>
           <ui-group-option>
@@ -141,7 +141,8 @@
     <span
       @click="unKeepAdding ? unKeepAdding() : keepAdding()"
       class="pin-position strengthen fun-ctrl"
-      v-if="node && complete"
+      :class="{ disabled: !data.points.length }"
+      v-if="node"
     >
       <ui-icon
         :style="{ color: unKeepAdding ? 'var(--color-main-normal)' : 'currentColor' }"
@@ -174,6 +175,7 @@ import {
   playScenePath,
 } from "@/sdk/association/path";
 import { nextTick } from "process";
+import path from "path";
 
 const props = defineProps<{ data: Path }>();
 
@@ -188,8 +190,6 @@ watch(node, () => {
   }
 });
 
-const currentComplete = !!props.data.points.length;
-const complete = ref(currentComplete);
 const activePointNdx = ref(-1);
 watchEffect((onCleanup) => {
   if (!node.value) return;
@@ -199,16 +199,10 @@ watchEffect((onCleanup) => {
   };
   $node.changeEditMode(true);
   $node.bus.on("activePoint", handler);
-  if (!currentComplete) {
-    $node.bus.on("drawed", () => (complete.value = true));
-  }
 
   onCleanup(() => {
     $node.bus.off("activePoint", handler);
     $node.changeEditMode(false);
-    if (!currentComplete) {
-      $node.bus.off("drawed");
-    }
   });
 });
 
@@ -229,6 +223,11 @@ const keepAdding = () => {
     unKeepAdding.value = void 0;
   };
 };
+
+if (!props.data.points.length) {
+  keepAdding();
+}
+
 onUnmounted(() => unKeepAdding.value && unKeepAdding.value());
 
 useViewStack(() => {