bill 1 ماه پیش
والد
کامیت
8635b082de
2فایلهای تغییر یافته به همراه17 افزوده شده و 7 حذف شده
  1. 16 6
      src/core/components/arrow/arrow.vue
  2. 1 1
      src/example/platform/resource-swkk.ts

+ 16 - 6
src/core/components/arrow/arrow.vue

@@ -25,11 +25,11 @@ import { ArrowData, getMouseStyle, defaultStyle, matResponse } from "./index.ts"
 import { TempComponent } from "./";
 import { useComponentStatus } from "@/core/hook/use-component.ts";
 import { Line } from "konva/lib/shapes/Line";
-import { Pos } from "@/utils/math.ts";
+import { lineLen, Pos, zeroEq } from "@/utils/math.ts";
 import { Group } from "konva/lib/Group";
 import { flatPositions } from "@/utils/shared.ts";
 import { themeColor } from "@/constant";
-import { watch } from "vue";
+import { watch, watchEffect } from "vue";
 
 const props = defineProps<{ data: ArrowData }>();
 const emit = defineEmits<{
@@ -87,10 +87,20 @@ const { shape, tData, operateMenus, describes, data } = useComponentStatus<
     // "zIndex",
   ],
 });
-watch(describes, describes => {
-  describes.fill.label = "颜色";
-  describes.strokeWidth.label = "粗细";
-}, {immediate: true})
+watch(
+  describes,
+  (describes) => {
+    describes.fill.label = "颜色";
+    describes.strokeWidth.label = "粗细";
+  },
+  { immediate: true }
+);
+
+watchEffect(() => {
+  if (zeroEq(lineLen(props.data.points[0], props.data.points[1]))) {
+    emit("delShape");
+  }
+});
 
 // const draw = useInteractiveDrawShapeAPI();
 // const store = useStore();

+ 1 - 1
src/example/platform/resource-swkk.ts

@@ -155,7 +155,7 @@ export const getCompass = async (scene: Scene) => {
   const { config, userFloorpan } = await fetchResource(scene);
   return userFloorpan !== undefined
     ? userFloorpan.compass
-    : Number(config.orientation || 0);
+    : MathUtils.radToDeg(Number(config.orientation || 0));
 };
 
 export const getHotTaggingInfos = async (scene: Scene, scale: number) => {