|
@@ -9,7 +9,9 @@
|
|
|
<PropertyUpdate
|
|
|
show
|
|
|
:name="propertyName"
|
|
|
+ :calDelete="true"
|
|
|
:describes="descs"
|
|
|
+ @delete="deleteHandler"
|
|
|
@change="changePropertyHandler"
|
|
|
v-if="setPropertyDatas.length"
|
|
|
/>
|
|
@@ -28,7 +30,10 @@ import {
|
|
|
GroupMatCtxItem,
|
|
|
} from "./index.ts";
|
|
|
import { useComponentStatus, useGetShapeBelong } from "@/core/hook/use-component.ts";
|
|
|
-import { useMouseShapeStatus } from "@/core/hook/use-mouse-status.ts";
|
|
|
+import {
|
|
|
+ useMouseShapesStatus,
|
|
|
+ useMouseShapeStatus,
|
|
|
+} from "@/core/hook/use-mouse-status.ts";
|
|
|
import { useCustomTransformer } from "@/core/hook/use-transformer.ts";
|
|
|
import { Rect } from "konva/lib/shapes/Rect";
|
|
|
import { setShapeTransform } from "@/utils/shape.ts";
|
|
@@ -80,6 +85,22 @@ const similars = {
|
|
|
形状: ["rectangle", "circle", "triangle", "polygon"],
|
|
|
} as Record<string, ShapeType[]>;
|
|
|
|
|
|
+const shapesStatus = useMouseShapesStatus();
|
|
|
+const deleteHandler = () => {
|
|
|
+ const delItems = selectIds.value.map(getShapeBelong).filter((item) => !!item);
|
|
|
+ history.onceTrack(() => {
|
|
|
+ delItems.forEach((belong) => {
|
|
|
+ const compDelItem = components[belong.type].delItem;
|
|
|
+ if (compDelItem) {
|
|
|
+ compDelItem(store, belong.item as any, belong.childrenId);
|
|
|
+ } else if (!belong.childrenId) {
|
|
|
+ store.delItem(belong.type, belong.item.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ shapesStatus.selects = [];
|
|
|
+};
|
|
|
+
|
|
|
const propertyName = computed(() => {
|
|
|
const types = new Set<ShapeType>();
|
|
|
const names = new Set<string>();
|
|
@@ -150,14 +171,7 @@ const { shape, tData, data } = useComponentStatus<Rect, GroupData>({
|
|
|
openSnap: false,
|
|
|
getRepShape($shape) {
|
|
|
const repShape = new Rect({ fill: themeColor, opacity: 0.3 });
|
|
|
- const syncShape = () => {
|
|
|
- autoUpdate.value && (prevMat = $shape.getTransform().copy());
|
|
|
- console.log("sync");
|
|
|
- };
|
|
|
- // $shape.on("bound-change", syncShape);
|
|
|
- syncShape();
|
|
|
const update = () => {
|
|
|
- console.log("update");
|
|
|
repShape.x($shape.x());
|
|
|
repShape.y($shape.y());
|
|
|
repShape.width($shape.width());
|
|
@@ -165,10 +179,19 @@ const { shape, tData, data } = useComponentStatus<Rect, GroupData>({
|
|
|
repShape.scale($shape.scale());
|
|
|
repShape.rotation($shape.rotation());
|
|
|
};
|
|
|
- update();
|
|
|
+ const syncShape = () => {
|
|
|
+ if (autoUpdate.value) {
|
|
|
+ prevMat = $shape.getTransform().copy();
|
|
|
+ update();
|
|
|
+ }
|
|
|
+ };
|
|
|
+ $shape.on("bound-change", syncShape);
|
|
|
+ syncShape();
|
|
|
return {
|
|
|
shape: repShape,
|
|
|
- update() {},
|
|
|
+ update() {
|
|
|
+ // update();
|
|
|
+ },
|
|
|
destory() {
|
|
|
$shape.off("bound-change", syncShape);
|
|
|
},
|