ソースを参照

feat: 修改bug

bill 1 年間 前
コミット
22c732dd2e

+ 8 - 3
src/assets/public.scss

@@ -143,6 +143,10 @@ samp {
     --colors-primary-fill     : 0, 0, 0;
     --editor-men-color        : rgb(0, 0, 0);
 
+    .photo-select {
+      box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
+    }
+
     .ui-menu-item.active {
       background-color: #EFF0F2;
     }
@@ -216,7 +220,7 @@ samp {
 
     .button-pane {
       .menu.active {
-        color           : rgba(23, 121, 237, 1) !important;
+        // color           : rgba(23, 121, 237, 1) !important;
         background-color: #EFF0F2;
       }
     }
@@ -259,7 +263,7 @@ samp {
 
     .photo-select {
       i {
-        color: #fff;
+        color: #000;
       }
     }
 
@@ -332,8 +336,9 @@ samp {
       .select-boxs span {
         color: #000;
 
-        &:not(.active) {
+        &.active {
           // background-color: rgba(0, 0, 0, 0.1);
+          color: #1779ed;
         }
       }
 

+ 3 - 0
src/components/group-button/index.vue

@@ -28,6 +28,9 @@
       <Switch
         :select="menu.switchValue.get()"
         @update:select="(val) => menu.switchValue.set(val)"
+        :class="{
+          disabled: disabledMap[menu.key],
+        }"
         v-else
       />
 

+ 4 - 4
src/components/switch/index.vue

@@ -36,17 +36,17 @@ defineEmits<{ (e: "update:select", v: boolean): void }>();
     background-color: #ccc;
 
     .switch-content {
-      left: 0;
+      left: 2px;
     }
   }
 
   .switch-content {
     position: absolute;
-    width: var(--size);
-    height: var(--size);
+    width: calc(var(--size) - 4px);
+    height: calc(var(--size) - 4px);
     border-radius: 50%;
     background-color: #fff;
-    top: 0;
+    top: 2px;
 
     transition: all 0.3s ease;
   }

+ 3 - 3
src/main.ts

@@ -5,9 +5,9 @@ if (import.meta.env.VITE_APP_SDK === "true") {
   import("./openSDK");
 }
 
-if (useParams().console === "true") {
-  new VConsole();
-}
+// if (useParams().console === "true") {
+new VConsole();
+// }
 
 import "@/assets/theme.editor.scss";
 import "@/assets/public.scss";

+ 19 - 2
src/views/graphic/confirm.vue

@@ -2,14 +2,16 @@
   <div class="confirm">
     <GraphicAction
       class="confirm-action"
-      @click="() => drawRef.uiControl.confirmCancel()"
+      :class="{ disabled: disCancel }"
+      @click="cancel"
       :type="1"
     >
       <ui-icon type="close" color="#f84540" />
     </GraphicAction>
     <GraphicAction
       class="confirm-action"
-      @click="() => drawRef.uiControl.confirmEntry()"
+      :class="{ disabled: disOk }"
+      @click="ok"
       :type="1"
     >
       <ui-icon type="affirm" color="#38c43b" />
@@ -22,6 +24,21 @@ import { customMap } from "@/hook";
 import GraphicAction from "@/components/button-pane/index.vue";
 import UiIcon from "@/components/base/components/icon/index.vue";
 import { uiType, drawRef } from "@/hook/useGraphic";
+
+withDefaults(
+  defineProps<{
+    disOk?: boolean;
+    disCancel?: boolean;
+    ok?: () => void;
+    cancel?: () => void;
+  }>(),
+  {
+    disOk: false,
+    disCancel: false,
+    ok: () => drawRef.value.uiControl.confirmCancel(),
+    cancel: () => () => drawRef.value.uiControl.confirmEntry(),
+  }
+);
 </script>
 
 <style scoped lang="scss">

+ 2 - 2
src/views/scene/container.vue

@@ -141,9 +141,9 @@ onMounted(async () => {
     position: absolute !important;
     // right: var(--boundMargin) !important;
     // top: var(--boundMargin) !important;
-    right: calc(var(--boundMargin) + 80px) !important;
+    right: calc(var(--boundMargin) + 90px) !important;
     top: auto !important;
-    bottom: calc(var(--boundMargin) + 80px) !important;
+    bottom: calc(var(--boundMargin) + 90px) !important;
 
     display: flex;
     align-items: center;

+ 8 - 3
src/views/scene/covers/fixPoint.vue

@@ -3,7 +3,7 @@
     @change-pos="(pos) => isPure && $emit('changePos', pos)"
     :pos="data.pos"
     @focus="emit('focus')"
-    @blur="emit('blur')"
+    @blur="!focus3d && emit('blur')"
     :focus="active"
     class="fix-cover"
   >
@@ -22,6 +22,7 @@ import { Pos3D } from "@/sdk";
 import { FixPoint, FixType } from "@/store/fixPoint";
 import { getFix3d } from "../fixManage";
 import { useAsyncSDK } from "@/hook";
+import { ref, watchEffect } from "vue";
 
 const props = defineProps<{
   data: FixPoint;
@@ -36,17 +37,21 @@ const emit = defineEmits<{
 }>();
 
 const isPure = !("type" in props.data) || props.data.type === FixType.POINT;
+const focus3d = ref(false);
+
 setTimeout(() => {
   const fix3d = getFix3d(props.data);
   if (fix3d && (!isPure || props.data.measure)) {
     fix3d.bus.on("selectMeasure", (select) => {
-      console.log("selectMeasure", select);
       select ? emit("focusMeasure") : emit("blurMeasure");
     });
     fix3d.bus.on("selectGraph", (select) => {
-      console.log("selected", select);
       select ? emit("focus") : emit("blur");
     });
+
+    // fix3d.bus.on("selectGraph", (select) => {
+    //   focus3d.value = select;
+    // });
   }
 });
 </script>

+ 27 - 27
src/views/scene/covers/fixPoints.vue

@@ -16,16 +16,24 @@
     <ActionMenus
       v-if="customMap.activeFixPoint"
       :menus="activeActionMenus"
-      :type="activeActionMenus.length === 1 ? 0 : 1"
+      :type="0"
       :active-key="edit ? 'edit' : null"
       dire="row"
     />
-    <ActionMenus
+
+    <Confirm
+      v-if="drawstatus === DrawStatus.ing"
+      :ok="() => (drawstatus = DrawStatus.complete)"
+      :cancel="() => (drawstatus = DrawStatus.quit)"
+      :dis-ok="!ready"
+    />
+    <!-- <ActionMenus
       v-if="ingActionMenus"
+      :type="0"
       :menus="ingActionMenus"
       :active-key="null"
       dire="row"
-    />
+    /> -->
   </div>
 
   <EditFixPoint
@@ -40,11 +48,19 @@
 <script setup lang="ts">
 import { fixPoints, FixPoint } from "@/store/fixPoint";
 import FixPointPanel from "./fixPoint.vue";
+import Confirm from "../../graphic/confirm.vue";
 import { computed, ref, watch, watchEffect } from "vue";
 import { customMap } from "@/hook";
 import ActionMenus from "@/components/group-button/index.vue";
 import EditFixPoint from "@/components/edit-fix-point/index.vue";
-import { delFix3d, changePos, quitMeasure, drawstatus, DrawStatus } from "../fixManage";
+import {
+  delFix3d,
+  changePos,
+  quitMeasure,
+  drawstatus,
+  DrawStatus,
+  drawingFix3d,
+} from "../fixManage";
 
 const edit = ref<FixPoint>();
 watchEffect(() => {
@@ -107,30 +123,14 @@ const activeActionMenus = computed(() =>
       ]
 );
 
-const ingActionMenus = computed(() => {
+const ready = ref(false);
+watchEffect(() => {
   if (drawstatus.value === DrawStatus.ing) {
-    return [
-      {
-        key: "edit",
-        icon: "edit",
-        text: "完成",
-        color: "#161A1A",
-        iconColor: "#2F8FFF",
-        onClick() {
-          drawstatus.value = DrawStatus.complete;
-        },
-      },
-      {
-        key: "delete",
-        icon: "del",
-        text: "取消",
-        color: "#FF4D4F",
-        iconColor: "#fff",
-        onClick() {
-          drawstatus.value = DrawStatus.quit;
-        },
-      },
-    ];
+    ready.value = false;
+    drawingFix3d.value[0].bus.on(
+      "graphChange",
+      (data) => (ready.value = data.path.length > 1)
+    );
   }
 });
 

+ 1 - 1
src/views/scene/covers/range.vue

@@ -130,7 +130,7 @@ onUnmounted(() => {
   .range-content {
     display: flex;
     align-items: center;
-    width: 290px;
+    width: 200px;
     height: 16px;
     .range-layout {
       height: 100%;

+ 3 - 3
src/views/scene/fixManage.ts

@@ -17,7 +17,7 @@ export const baseCheck = () => {
   if (!baseLines.value.length) {
     useConfirm({
       title: "提示",
-      content: "请线绘制基准线",
+      content: "请绘制基准线",
       okText: "去绘制",
       noText: "取消",
     }).then((ok) => {
@@ -30,7 +30,7 @@ export const baseCheck = () => {
   if (!basePoints.value.length) {
     useConfirm({
       title: "提示",
-      content: "请线创建基准点",
+      content: "请创建基准点",
       okText: "创建基准点",
       noText: "取消",
     }).then((ok) => {
@@ -83,7 +83,7 @@ export enum DrawStatus {
 export const drawstatus = ref(DrawStatus.un);
 export const measureMode = ref(false);
 export const trackBaseIng = ref(false);
-const drawingFix3d = shallowRef<FixPoint3D[]>([]);
+export const drawingFix3d = shallowRef<FixPoint3D[]>([]);
 
 watchEffect(() => {
   if (drawstatus.value === DrawStatus.complete) {

+ 14 - 3
src/views/scene/menus/actions.ts

@@ -1,4 +1,9 @@
-import { findMenuByKey, menuEnum, MenuRaw } from "@/views/scene/menus/menus";
+import {
+  findMenuByKey,
+  menuEnum,
+  MenuRaw,
+  showMenus,
+} from "@/views/scene/menus/menus";
 import {
   continuedMeasure,
   startMeasure,
@@ -7,7 +12,7 @@ import {
 import { list, MeasureAtom, MeasureType } from "@/store/measure";
 import { baseLines } from "@/store/baseLine";
 import { basePoints } from "@/store/basePoint";
-import { nextTick, reactive, Ref, watch } from "vue";
+import { nextTick, reactive, ref, Ref, watch } from "vue";
 import {
   activeBasePointStack,
   activeFixPointStack,
@@ -194,6 +199,7 @@ const menuActions = {
     let hide;
     const add = () => {
       hide = Message.success({ msg: "请单击绘制固定点形状" });
+      showMenus.value = false;
       const data: FixPoint = reactive({
         id: getId(),
         pos: { x: 0, y: 0, z: 0 },
@@ -206,6 +212,8 @@ const menuActions = {
       drawstatus.value = DrawStatus.ing;
       const fix3d = getFix3d(data);
       fix3d.bus.on("graphDrawComplete", (complete) => {
+        console.error("????");
+        showMenus.value = true;
         trackBaseIng.value = false;
         if (complete) {
           const len = fixPoints.value.push(data);
@@ -237,6 +245,7 @@ const menuActions = {
       });
     }
     return () => {
+      showMenus.value = true;
       drawstatus.value = DrawStatus.quit;
       trackBaseIng.value = false;
       hide && hide();
@@ -305,7 +314,9 @@ const menuActions = {
       list.value = [];
       baseLines.value = [];
       basePoints.value = [];
-      fixPoints.value.forEach((fix) => delFix3d(fix));
+      while (fixPoints.value.length) {
+        delFix3d(fixPoints.value[0]);
+      }
       fixPoints.value = [];
     }
     onComplete();

+ 13 - 2
src/views/scene/menus/menus.ts

@@ -11,7 +11,12 @@ import { fixPoints } from "@/store/fixPoint";
 import { basePoints } from "@/store/basePoint";
 import { list } from "@/store/measure";
 import { sceneSeting } from "@/store/sceneSeting";
-import { drawstatus, measureMode } from "../fixManage";
+import {
+  DrawStatus,
+  drawingFix3d,
+  drawstatus,
+  measureMode,
+} from "../fixManage";
 
 export type MenuRaw = {
   key: string;
@@ -100,12 +105,16 @@ export const menus: MenuRaw[] = [
         key: menuEnum.FIX_POINT,
       },
       {
-        icon: "point_a",
+        icon: "draw_s",
         text: "绘制线",
         key: menuEnum.FIX_GRANH,
       },
       {
         text: "垂足",
+        disabled: () => {
+          console.error(drawstatus.value !== DrawStatus.un);
+          return drawstatus.value === DrawStatus.ing;
+        },
         switch: true,
         switchValue: {
           get: () => measureMode.value,
@@ -219,3 +228,5 @@ export const generateMixMenus = <T extends {}, K extends keyof MenuRaw>(
 
 export const findMenuByKey = (value: menuEnum) =>
   findMenuByAttr(value, "key", menus);
+
+export const showMenus = ref(true);

+ 2 - 1
src/views/scene/menus/pane.vue

@@ -1,5 +1,6 @@
 <template>
   <ActionMenus
+    v-show="showMenus"
     v-if="!store.child.value"
     class="menus abc"
     :class="{ level: level === 2 }"
@@ -20,7 +21,7 @@
 <script lang="ts" setup>
 import ActionMenus from "@/components/group-button/index.vue";
 
-import { generateMixMenus, MenuRaw, menus, findMenuByKey } from "./menus";
+import { generateMixMenus, MenuRaw, menus, findMenuByKey, showMenus } from "./menus";
 import { joinActions } from "./actions";
 import { computed, onMounted, onUnmounted, ref, watchEffect } from "vue";
 import { disabledMap } from "@/hook";

+ 1 - 0
src/views/scene/scene.vue

@@ -33,6 +33,7 @@ import { disabledMap, useSDK } from "@/hook";
 import customSetup from "../../hook/custom";
 import { ref, watchEffect } from "vue";
 import { trackMode } from "@/views/scene/trackMeasureWidth";
+import { showMenus } from "./menus/menus";
 
 withDefaults(defineProps<{ viewStatus: boolean }>(), { viewStatus: true });
 defineEmits<{ (e: "update:viewStatus", v: boolean): void }>();

+ 0 - 1
vite.config.ts

@@ -9,7 +9,6 @@ export default async ({ mode }) => {
   const env = loadEnv(mode, process.cwd());
   const isDev = mode === "development" || env.VITE_DEV_ENV === "true";
 
-  console.log(isDev);
   let server;
   if (isDev) {
     await createMockServer(Number(env.VITE_DEV_PORT));