|
@@ -8,6 +8,7 @@ import { ICompKeys, Layout } from "../../typings";
|
|
|
import CompSave from "../../components/CompSave";
|
|
|
import { ObjsContainer } from "../../controllers/SelectCtrl/ObjsContainer";
|
|
|
import { getKeyThenIncreaseKey } from "ant-design-vue/lib/message";
|
|
|
+import { Matrix } from "../../controllers/SelectCtrl/matrix";
|
|
|
|
|
|
export const editActions = EditorModule.action({
|
|
|
pickComp(compId: string, selected = true) {
|
|
@@ -541,19 +542,23 @@ export const editActions = EditorModule.action({
|
|
|
// 取消打组
|
|
|
cancelGroupComps(groupComp: DesignComp) {
|
|
|
console.log("cancel group");
|
|
|
- // const childs = groupComp.children.default;
|
|
|
- // const objC = this.controls.selectCtrl.objContainer as ObjsContainer;
|
|
|
-
|
|
|
- // objC.parent.children.forEach(o=>{
|
|
|
- // const obj = o as CompObject;
|
|
|
- // obj.comp.layout.transformMatrix = o.worldTransform.getMatrixStr();
|
|
|
- // })
|
|
|
-
|
|
|
- // this.controls.transferCtrl.groupCtrl.cancelGroup(groupComp);
|
|
|
-
|
|
|
- // this.store.setCurrComp(groupComp.children.default?.[0] as string);
|
|
|
-
|
|
|
|
|
|
+ const childs = groupComp.children.default || [];
|
|
|
+ const objC = this.controls.selectCtrl.objContainer as ObjsContainer;
|
|
|
+ const parentMtrx = objC.parent.worldTransform.clone();
|
|
|
+ childs.forEach(o=>{
|
|
|
+ const obj = this.helper.findComp(o) as DesignComp;
|
|
|
+ const mxt = Matrix.createFromMatrixStr(obj.layout.transformMatrix as string);
|
|
|
+ mxt.prepend(parentMtrx);
|
|
|
+ obj.layout.transformMatrix = mxt.getMatrixStr();
|
|
|
+ })
|
|
|
+ const paths = this.helper.getCompTrees(groupComp.id)
|
|
|
+ const card = paths[1];
|
|
|
+ const parentChilds = (card.children.default || []).filter(item=>item != groupComp.id);
|
|
|
+ parentChilds.push(...childs);
|
|
|
+ card.children.default = childs;
|
|
|
+
|
|
|
+ this.actions.selectObjs([childs[0]]);
|
|
|
},
|
|
|
|
|
|
createGroupComps() {
|