bill 2 лет назад
Родитель
Сommit
70041dcd46

+ 2 - 1
src/components/switch/index.vue

@@ -36,11 +36,12 @@ defineEmits<{ (e: "update:select", v: boolean): void }>();
     background-color: #ccc;
 
     .switch-content {
-      left: 2px;
+      left: 0;
     }
   }
 
   .switch-content {
+    margin-left: 2px;
     position: absolute;
     width: calc(var(--size) - 4px);
     height: calc(var(--size) - 4px);

+ 22 - 5
src/sdk/types/sdk.ts

@@ -35,7 +35,10 @@ export type Base = Emitter<SceneEventMap> & {
   // 通过DOM坐标获取真实坐标
   getPointByScreen: (screen?: Pos & { inDrag?: boolean }) => PointInfo | null;
   // 通过真实坐标获取DOM坐标
-  getScreenByPoint: (point: Pos, slide?: boolean) => { pos: Pos; trueSide: boolean };
+  getScreenByPoint: (
+    point: Pos,
+    slide?: boolean
+  ) => { pos: Pos; trueSide: boolean };
 
   screenshot: (
     width: number,
@@ -79,7 +82,8 @@ export type Measure = {
 };
 
 export type StartMeasure = Measure & {
-  bus: Emitter<{ end: Measure; quit: Measure; invalidPoint: string }> & Measure["bus"];
+  bus: Emitter<{ end: Measure; quit: Measure; invalidPoint: string }> &
+    Measure["bus"];
   quit: () => void;
   end: () => void;
 };
@@ -245,7 +249,11 @@ export type Scene = Base & {
   quitMeasure(): void;
   changeMode(mode: Mode): void;
   getCurrentMode(): Mode;
-  startMeasure(type: MeasureType, unit: MeasureUnit, color: string): StartMeasure;
+  startMeasure(
+    type: MeasureType,
+    unit: MeasureUnit,
+    color: string
+  ): StartMeasure;
   drawMeasure(
     type: MeasureType,
     unit: MeasureUnit,
@@ -339,6 +347,7 @@ export type FixPoint3D = {
 
   show: () => void;
   hide: () => void;
+  selected: (select: boolean) => void;
   bus: Emitter<{
     // 测量线被选中对象,值为是否选中
     selectGraph: boolean;
@@ -555,7 +564,11 @@ export type LaserSDK = {
   enterEditClouds: (data: EditCloudsArgs) => EditClouds;
   enterEditCrop: () => EditCrop;
 
-  transformPoint: (point: Pos3D, datasetId: string, dataset_location: Pos3D) => Pos3D;
+  transformPoint: (
+    point: Pos3D,
+    datasetId: string,
+    dataset_location: Pos3D
+  ) => Pos3D;
 
   enterMeasurement: () => void;
   leaveMeasurement: () => void;
@@ -571,7 +584,11 @@ export type LaserSDK = {
 
   enterFireEdit: () => void;
 
-  insertEffect: (type: TypeEmu, prop: InsertEffectProp, edit: boolean) => Effect;
+  insertEffect: (
+    type: TypeEmu,
+    prop: InsertEffectProp,
+    edit: boolean
+  ) => Effect;
 
   debug: boolean;
   // 加载小物体

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

@@ -35,8 +35,8 @@ withDefaults(
   {
     disOk: false,
     disCancel: false,
-    ok: () => drawRef.value.uiControl.confirmCancel(),
-    cancel: () => () => drawRef.value.uiControl.confirmEntry(),
+    ok: () => drawRef.value.uiControl.confirmEntry(),
+    cancel: () => () => drawRef.value.uiControl.confirmCancel(),
   }
 );
 </script>

+ 3 - 3
src/views/photos/index.vue

@@ -79,7 +79,7 @@ import ActionMenus from "@/components/group-button/index.vue";
 import { useConfirm } from "@/hook";
 import UiInput from "@/components/base/components/input/index.vue";
 import { api, downloadImage, uploadImage } from "@/store/sync";
-import { formatDate, getId, imageToBlob } from "@/utils";
+import { asyncTimeout, formatDate, getId, imageToBlob } from "@/utils";
 import { genUseLoading } from "@/hook";
 
 const sortPhotos = computed(() => [...photos.value].reverse());
@@ -101,7 +101,7 @@ const menus = [
   },
 ];
 
-const sharePhoto = async () => {
+const sharePhoto = genUseLoading(async () => {
   // 如果没下载过相册则下载,通过文件名判断
   if (!active.value.url.includes("img_")) {
     const filename = `img_${formatDate(new Date(), "yyyyMMddhhmmss")}_${
@@ -116,7 +116,7 @@ const sharePhoto = async () => {
   }
 
   api.shareImage(active.value.url);
-};
+});
 
 const selectMenus = [
   {

+ 7 - 5
src/views/scene/covers/fixPoint.vue

@@ -2,8 +2,8 @@
   <Cover
     @change-pos="(pos) => isPure && $emit('changePos', pos)"
     :pos="data.pos"
-    @focus="emit('focus')"
-    @blur="!focus3d && emit('blur')"
+    @focus="emit('focus', false)"
+    @blur="!focus3d && emit('blur', false)"
     :focus="active"
     class="fix-cover"
   >
@@ -30,8 +30,8 @@ const props = defineProps<{
 }>();
 const emit = defineEmits<{
   (m: "changePos", pos: Pos3D): void;
-  (m: "focus"): void;
-  (m: "blur"): void;
+  (m: "focus", isRaw: boolean): void;
+  (m: "blur", isRaw: boolean): void;
   (m: "focusMeasure"): void;
   (m: "blurMeasure"): void;
 }>();
@@ -41,12 +41,14 @@ const focus3d = ref(false);
 
 setTimeout(() => {
   const fix3d = getFix3d(props.data);
+
   if (fix3d && (!isPure || props.data.measure)) {
     fix3d.bus.on("selectMeasure", (select) => {
       select ? emit("focusMeasure") : emit("blurMeasure");
     });
     fix3d.bus.on("selectGraph", (select) => {
-      select ? emit("focus") : emit("blur");
+      console.error("selectGraph");
+      select ? emit("focus", true) : emit("blur", true);
     });
 
     // fix3d.bus.on("selectGraph", (select) => {

+ 24 - 9
src/views/scene/covers/fixPoints.vue

@@ -3,12 +3,12 @@
     v-for="point in (fixPoints as FixPoint[])"
     :key="point.id"
     :data="point"
-    :active="point === customMap.activeFixPoint"
+    :active="point === customMap.activeFixPoint && !selectMeasure"
     @change-pos="(pos) => changePos(point, pos)"
-    @focus="select(point, false)"
-    @blur="unSelect(point, false)"
-    @focus-measure="select(point, true)"
-    @blur-measure="unSelect(point, true)"
+    @focus="(isRaw) => select(point, false, isRaw)"
+    @blur="(isRaw) => unSelect(point, false, isRaw)"
+    @focus-measure="select(point, true, true)"
+    @blur-measure="unSelect(point, true, true)"
   />
 
   <div ref="menu" @touchstart.stop class="action-menus">
@@ -49,7 +49,7 @@
 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 { computed, ref, toRaw, 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";
@@ -60,6 +60,7 @@ import {
   drawstatus,
   DrawStatus,
   drawingFix3d,
+  selectFix3d,
 } from "../fixManage";
 
 const edit = ref<FixPoint>();
@@ -70,15 +71,29 @@ watchEffect(() => {
 });
 
 const selectMeasure = ref(false);
-const select = (point: FixPoint, onMeasure: boolean = false) => {
-  console.error(onMeasure);
+const select = (point: FixPoint, onMeasure: boolean = false, onRaw: boolean = false) => {
   selectMeasure.value = onMeasure;
   customMap.activeFixPoint = point;
+
+  if (!onRaw) {
+    fixPoints.value.forEach((item) => {
+      console.log("select", toRaw(item) === toRaw(point));
+      selectFix3d(point, toRaw(item) === toRaw(point));
+    });
+  }
 };
-const unSelect = (point: FixPoint, onMeasure: boolean = false) => {
+const unSelect = (
+  point: FixPoint,
+  onMeasure: boolean = false,
+  onRaw: boolean = false
+) => {
   selectMeasure.value = onMeasure;
   customMap.activeFixPoint =
     customMap.activeFixPoint === point ? null : customMap.activeFixPoint;
+
+  if (!onRaw) {
+    selectFix3d(point, false);
+  }
 };
 
 const activeActionMenus = computed(() =>

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

@@ -118,9 +118,7 @@ const fixJoinBase = (data: FixPoint, fix3d: FixPoint3D) => {
 
   const stopBasePosWatch = watch(
     () => {
-      const basePoint = basePoints.value.find(
-        (base) => base.id === data.baseId
-      );
+      const basePoint = basePoints.value.find((base) => base.id === data.baseId);
       return basePoint ? { ...basePoint.pos } : null;
     },
     (basePos) => {
@@ -203,6 +201,13 @@ export const quitMeasure = (data: FixPoint) => {
   }
 };
 
+export const selectFix3d = (data: FixPoint, selected: boolean) => {
+  const fix3d = fix3ds[data.id];
+  if (fix3d) {
+    fix3d.selected(selected);
+  }
+};
+
 export const changePos = (data: FixPoint, pos: FixPoint["pos"]) => {
   Object.assign(data, { pos });
   const fix3d = fix3ds[data.id];