Przeglądaj źródła

Merge branch 'v1.2.0-ga' of http://192.168.0.115:3000/bill/fuse-code into v1.2.0-ga

xzw 5 miesięcy temu
rodzic
commit
f1bedf91c0

+ 1 - 1
.env

@@ -1,5 +1,5 @@
 VITE_LASER_HOST=
 VITE_LASER_OSS=/laser-data
 VITE_OSS=/oss
-VITE_PANO_OSS=/laser-data
+VITE_PANO_OSS=/oss
 

+ 9 - 1
src/components/right-menu/index.ts

@@ -14,7 +14,7 @@ export const useRMenus = (
   menus: RMenu[],
   dom = document.querySelector("#app")!
 ) => {
-  const unMount = mount(
+  let unMountRaw = mount(
     dom as HTMLDivElement,
     RMenuComp,
     reactive({
@@ -25,4 +25,12 @@ export const useRMenus = (
       }
     })
   );
+  let isUn = false
+  const unMount = () => {
+    if (!isUn) {
+      unMountRaw()
+      isUn = true
+    }
+  }
+  return unMount
 };

+ 6 - 2
src/components/right-menu/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <Dropdown v-model:open="open">
+  <Dropdown v-model:open="open" overlayClassName="down-item">
     <span class="proce" :style="{ left: pixel.x + 'px', top: pixel.y + 'px' }"></span>
     <template #overlay>
       <Menu>
@@ -29,12 +29,16 @@ watchEffect(() => {
 
 const clickHandler = (menu: RMenu) => {
   menu.handler();
-  props.onClose()
+  props.onClose();
 };
 </script>
 
 <style lang="scss" scoped>
 .proce {
   position: absolute;
+  width: 5px;
+  height: 5px;
+  transform: translate(-50%, -50%);
+  z-index: 99;
 }
 </style>

+ 2 - 2
src/utils/event.ts

@@ -63,12 +63,12 @@ export const dragListener = (dom: HTMLElement, props: DragProps | DragProps['mov
 
 
 
-export const clickListener = (dom: HTMLDivElement, callback: (position: Pos, ev: PointerEvent) => void) => {
+export const clickListener = (dom: HTMLDivElement, callback: (position: Pos, ev: PointerEvent) => void, button = 0) => {
 	let downTime = 0;
 	let move = false
 	return dragListener(dom, {
 		down(_, ev) {
-			if (ev.button !== 0) return;
+			if (ev.button !== button) return;
 			downTime = Date.now();
 		},
 		up(position, ev) {

+ 12 - 10
src/views/merge/index.vue

@@ -69,7 +69,7 @@ import Actions from "@/components/actions-merge/index.vue";
 
 import type { ActionsProps, ActionsItem } from "@/components/actions/index.vue";
 import { listener } from "@/components/drawing/hook";
-import { getOffset } from "@/utils/event";
+import { clickListener, getOffset } from "@/utils/event";
 import { useRMenus } from "@/components/right-menu";
 
 const active = useActive();
@@ -155,19 +155,20 @@ const reset = async () => {
   }
 };
 
+let unMount: (() => void) | null = null;
 useViewStack(() =>
   togetherCallback([
     showLeftPanoStack.push(ref(true)),
     showRightPanoStack.push(computed(() => !!custom.currentModel)),
     modelsChangeStoreStack.push(ref(true)),
-    listener(
-      document.querySelector("#layout-app") as HTMLElement,
-      "contextmenu",
-      (ev) => {
-        const pixel = getOffset(ev);
+    clickListener(
+      document.querySelector("#layout-app") as HTMLDivElement,
+      (pixel) => {
         const pos = sdk.getPositionByScreen(pixel);
-        if (custom.currentModel) {
-          useRMenus(pixel, [
+        if (!custom.currentModel) return;
+        unMount && unMount();
+        setTimeout(() => {
+          unMount = useRMenus(pixel, [
             {
               label: "移动到这里",
               icon: "close",
@@ -176,8 +177,9 @@ useViewStack(() =>
               },
             },
           ]);
-        }
-      }
+        });
+      },
+      2
     ),
     () => (currentItem.value = null),
   ])