|
|
@@ -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();
|