|
@@ -1,10 +1,10 @@
|
|
|
-import { cloneDeep, pick, set } from "lodash";
|
|
|
+import { cloneDeep, pick } from "lodash";
|
|
|
import { Exception, queenApi } from "queenjs";
|
|
|
import { EditorModule } from "..";
|
|
|
import { ScreenshotCtrl } from "../../controllers/ScreenshotCtrl";
|
|
|
+import { CompObject } from "../../controllers/SelectCtrl/compObj";
|
|
|
import { DesignComp } from "../../objects/DesignTemp/DesignComp";
|
|
|
import { ICompKeys, Layout } from "../../typings";
|
|
|
-import { CompObject } from "../../controllers/SelectCtrl/compObj";
|
|
|
|
|
|
export const editActions = EditorModule.action({
|
|
|
// 通过拖拽添加组件到画布
|
|
@@ -35,7 +35,6 @@ export const editActions = EditorModule.action({
|
|
|
cb?.(currComp);
|
|
|
|
|
|
//添加组件到当前选中的组件下面
|
|
|
- const obj = new CompObject(currComp);
|
|
|
const selectCtrl = this.controls.selectCtrl;
|
|
|
let xOffset = this.helper.designSizeToPx(375 - (currComp.layout.size?.[0] || 750) / 2);
|
|
|
selectCtrl.translate(xOffset, yOffset);
|
|
@@ -69,44 +68,44 @@ export const editActions = EditorModule.action({
|
|
|
},
|
|
|
|
|
|
// 切换当前组件
|
|
|
- pickComp(compId: string) {
|
|
|
- const { store, helper } = this;
|
|
|
- // 组合模式下,切换组件
|
|
|
- // if (store.currCompId && store.groupModeStatus) {
|
|
|
- // const enableGroupIds = helper
|
|
|
- // .findParentComp(compId)
|
|
|
- // ?.getChildIds() as string[];
|
|
|
- // const comps = helper.getCompTrees(compId);
|
|
|
- // while (comps.length) {
|
|
|
- // const comp = comps.pop() as DesignComp;
|
|
|
- // const index = store.groupIds.indexOf(comp.id);
|
|
|
- // if (index >= 0) {
|
|
|
- // const groupIds = [...store.groupIds];
|
|
|
- // groupIds.splice(index, 1);
|
|
|
- // store.setGroupIds(groupIds);
|
|
|
- // } else if (enableGroupIds.includes(comp.id)) {
|
|
|
- // store.groupIds.push(comp.id);
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // }
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // let nextCompId = compId;
|
|
|
- // if (this.store.isEditPage) {
|
|
|
- // const comps = this.helper.getCompTrees(compId);
|
|
|
- // nextCompId = comps[1].id;
|
|
|
- // }
|
|
|
- if (this.store.currCompId == compId) {
|
|
|
- return;
|
|
|
- }
|
|
|
- if (this.store.currComp.compKey == "Text") {
|
|
|
- this.store.setTextEditingState(false);
|
|
|
- }
|
|
|
- this.store.setCurrComp(compId);
|
|
|
- if (this.store.currCompId == this.store.currStreamCardId) {
|
|
|
- this.controls.transferCtrl.destroy();
|
|
|
- }
|
|
|
- },
|
|
|
+ // pickComp(compId: string) {
|
|
|
+ // const { store, helper } = this;
|
|
|
+ // // 组合模式下,切换组件
|
|
|
+ // // if (store.currCompId && store.groupModeStatus) {
|
|
|
+ // // const enableGroupIds = helper
|
|
|
+ // // .findParentComp(compId)
|
|
|
+ // // ?.getChildIds() as string[];
|
|
|
+ // // const comps = helper.getCompTrees(compId);
|
|
|
+ // // while (comps.length) {
|
|
|
+ // // const comp = comps.pop() as DesignComp;
|
|
|
+ // // const index = store.groupIds.indexOf(comp.id);
|
|
|
+ // // if (index >= 0) {
|
|
|
+ // // const groupIds = [...store.groupIds];
|
|
|
+ // // groupIds.splice(index, 1);
|
|
|
+ // // store.setGroupIds(groupIds);
|
|
|
+ // // } else if (enableGroupIds.includes(comp.id)) {
|
|
|
+ // // store.groupIds.push(comp.id);
|
|
|
+ // // return;
|
|
|
+ // // }
|
|
|
+ // // }
|
|
|
+ // // return;
|
|
|
+ // // }
|
|
|
+ // // let nextCompId = compId;
|
|
|
+ // // if (this.store.isEditPage) {
|
|
|
+ // // const comps = this.helper.getCompTrees(compId);
|
|
|
+ // // nextCompId = comps[1].id;
|
|
|
+ // // }
|
|
|
+ // if (this.store.currCompId == compId) {
|
|
|
+ // return;
|
|
|
+ // }
|
|
|
+ // if (this.store.currComp.compKey == "Text") {
|
|
|
+ // this.store.setTextEditingState(false);
|
|
|
+ // }
|
|
|
+ // this.store.setCurrComp(compId);
|
|
|
+ // if (this.store.currCompId == this.store.currStreamCardId) {
|
|
|
+ // this.controls.transferCtrl.destroy();
|
|
|
+ // }
|
|
|
+ // },
|
|
|
// 切换到父组件
|
|
|
pickParentComp(compId: string) {
|
|
|
const parentComp = this.helper.findParentComp(compId);
|
|
@@ -248,10 +247,6 @@ export const editActions = EditorModule.action({
|
|
|
comp.layout.transformMatrix = transformMatrix;
|
|
|
},
|
|
|
|
|
|
- updateCompData(comp: DesignComp, path: string, value: any) {
|
|
|
- set(comp, path, value);
|
|
|
- },
|
|
|
-
|
|
|
// 设置组件浮动
|
|
|
setCompPositionFloat(comp: DesignComp) {
|
|
|
comp.layout.position = "absolute"
|