|
@@ -5,7 +5,7 @@
|
|
|
<EditLine
|
|
|
:ref="(d: any) => shape = d?.shape"
|
|
|
:data="lineData"
|
|
|
- :opacity="0"
|
|
|
+ :opacity="renderer ? 0 : 1"
|
|
|
:points="points"
|
|
|
:closed="false"
|
|
|
:id="line.id"
|
|
@@ -22,45 +22,22 @@
|
|
|
@add-point="addPoint"
|
|
|
/>
|
|
|
|
|
|
- <v-line
|
|
|
- v-for="polygon in polygons"
|
|
|
- :config="{
|
|
|
- opacity: drawProps ? 0.7 : 1,
|
|
|
- points: flatPositions(polygon),
|
|
|
- fill: isDrawIng ? themeColor : style.stroke,
|
|
|
- closed: true,
|
|
|
- listening: false,
|
|
|
- }"
|
|
|
- />
|
|
|
- <!-- v-if="status.active" -->
|
|
|
- <!-- <v-text :config="{ ...pointsCenter(points), text: line.id }" /> -->
|
|
|
- <template
|
|
|
- v-if="
|
|
|
+ <component
|
|
|
+ v-if="renderer"
|
|
|
+ :is="renderer?.Component"
|
|
|
+ :opacity="drawProps ? 0.7 : 1"
|
|
|
+ :stroke="isDrawIng ? themeColor : style.stroke"
|
|
|
+ :getShapeAttrib="getShapeAttrib"
|
|
|
+ :data="data"
|
|
|
+ :line="line"
|
|
|
+ :showLabel="
|
|
|
status.active ||
|
|
|
config.showComponentSize ||
|
|
|
isDrawIng ||
|
|
|
dragPointIds?.includes(line.a) ||
|
|
|
dragPointIds?.includes(line.b)
|
|
|
"
|
|
|
- >
|
|
|
- <v-group>
|
|
|
- <template v-if="gd.steps.value.length">
|
|
|
- <SizeLine
|
|
|
- :points="line"
|
|
|
- :strokeWidth="style.strokeWidth"
|
|
|
- :stroke="style.stroke"
|
|
|
- v-for="line in [...gd.steps.value, ...gd.subSteps.value]"
|
|
|
- />
|
|
|
- </template>
|
|
|
- <SizeLine
|
|
|
- :points="points"
|
|
|
- :strokeWidth="style.strokeWidth"
|
|
|
- :stroke="style.stroke"
|
|
|
- v-else
|
|
|
- />
|
|
|
- </v-group>
|
|
|
- </template>
|
|
|
-
|
|
|
+ />
|
|
|
<PropertyUpdate
|
|
|
:describes="describes"
|
|
|
:data="line"
|
|
@@ -82,7 +59,7 @@
|
|
|
:data="drawProps.data"
|
|
|
:line="drawProps.prev"
|
|
|
:drawMode="drawProps.point"
|
|
|
- :get-extend-polygon="drawGetExtendPolygon"
|
|
|
+ :getShapeAttrib="drawGetShapeAttrib"
|
|
|
/>
|
|
|
<singlePoint
|
|
|
:data="drawProps.data"
|
|
@@ -93,7 +70,7 @@
|
|
|
:data="drawProps.data"
|
|
|
:line="drawProps.next"
|
|
|
:drawMode="drawProps.point"
|
|
|
- :get-extend-polygon="drawGetExtendPolygon"
|
|
|
+ :getShapeAttrib="drawGetShapeAttrib"
|
|
|
/>
|
|
|
<singlePoint
|
|
|
:data="drawProps.data"
|
|
@@ -107,12 +84,11 @@
|
|
|
import EditLine from "../share/edit-line.vue";
|
|
|
import singlePoint from "./single-point.vue";
|
|
|
import { computed, ref } from "vue";
|
|
|
-import { getMouseStyle, LineData, LineDataLine, shapeName } from "./index.ts";
|
|
|
-import { flatPositions, onlyId } from "@/utils/shared.ts";
|
|
|
-import { pointsCenter, Pos } from "@/utils/math.ts";
|
|
|
+import { getMouseStyle, LineData, LineDataLine, shapeName, renderer } from "./index.ts";
|
|
|
+import { onlyId } from "@/utils/shared.ts";
|
|
|
+import { Pos } from "@/utils/math.ts";
|
|
|
import { Line } from "konva/lib/shapes/Line";
|
|
|
import { DC } from "@/deconstruction.js";
|
|
|
-import SizeLine from "../share/size-line.vue";
|
|
|
import { useConfig } from "@/core/hook/use-config.ts";
|
|
|
import { PropertyUpdate, Operate } from "../../html-mount/propertys/index.ts";
|
|
|
import {
|
|
@@ -120,7 +96,6 @@ import {
|
|
|
useMouseShapeStatus,
|
|
|
} from "@/core/hook/use-mouse-status.ts";
|
|
|
import { themeColor } from "@/constant";
|
|
|
-import { useGetDiffLineIconPolygons, useGetExtendPolygon } from "./attach-view.ts";
|
|
|
import {
|
|
|
getLinePoints,
|
|
|
useDrawLinePoint,
|
|
@@ -137,7 +112,7 @@ const props = defineProps<{
|
|
|
data: LineData;
|
|
|
dragPointIds?: string[];
|
|
|
drawMode?: LineData["points"][number];
|
|
|
- getExtendPolygon: (line: LineDataLine) => Pos[];
|
|
|
+ getShapeAttrib?: (line: LineDataLine) => any;
|
|
|
}>();
|
|
|
|
|
|
const emit = defineEmits<{
|
|
@@ -154,11 +129,8 @@ const emit = defineEmits<{
|
|
|
(e: "dragLineEnd", value: LineDataLine): void;
|
|
|
}>();
|
|
|
|
|
|
-const polygon = computed(() => props.getExtendPolygon(line.value));
|
|
|
const line = computed(() => props.line);
|
|
|
const points = computed(() => getLinePoints(props.data, props.line));
|
|
|
-const gd = useGetDiffLineIconPolygons(line.value, points);
|
|
|
-const polygons = computed(() => gd.diff(polygon.value));
|
|
|
|
|
|
const shape = ref<DC<Line>>();
|
|
|
const lineData = computed(() => props.line);
|
|
@@ -189,8 +161,10 @@ const { drawProps, enter: enterDrawLinePoint } = useDrawLinePoint(
|
|
|
}
|
|
|
);
|
|
|
|
|
|
-const drawGetExtendPolygon = useGetExtendPolygon(computed(() => drawProps.value?.data));
|
|
|
-
|
|
|
+const drawData = computed(() => drawProps.value?.data);
|
|
|
+const drawGetShapeAttrib = computed(
|
|
|
+ () => renderer.value && renderer.value.genGetShapeAttrib(drawData)
|
|
|
+);
|
|
|
const menus = [
|
|
|
{ label: "加点", handler: enterDrawLinePoint },
|
|
|
{ label: "删除", handler: delHandler },
|