|
@@ -11,17 +11,13 @@ export const editActions = EditorModule.action({
|
|
|
async dragCompToDesign(event: MouseEvent, compKey: ICompKeys) {
|
|
|
await this.actions.addCompToDesign(compKey);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const cardPoints = this.helper.getPointOffsetWith(
|
|
|
event,
|
|
|
this.store.currStreamCard.$el
|
|
|
);
|
|
|
const { currComp } = this.store;
|
|
|
let selCtrl = this.controls.selectCtrl
|
|
|
- selCtrl.selecteObjs([new CompObject(currComp) ])
|
|
|
selCtrl.translate(this.helper.designSizeToPx(375 - (currComp.layout.size?.[0] || 750) / 2), cardPoints.y);
|
|
|
-
|
|
|
this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
|
|
|
|
},
|
|
@@ -36,7 +32,6 @@ export const editActions = EditorModule.action({
|
|
|
//添加组件到当前选中的组件下面
|
|
|
const obj = new CompObject(currComp);
|
|
|
const selectCtrl = this.controls.selectCtrl;
|
|
|
- selectCtrl.selecteObjs([obj]);
|
|
|
selectCtrl.translate(0, bound.y + bound.h);
|
|
|
|
|
|
//扩展
|
|
@@ -51,7 +46,6 @@ export const editActions = EditorModule.action({
|
|
|
//必须选中一个streamCard
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
if (compKey == "Container") {
|
|
|
index = this.store.streamCardIds.indexOf(this.store.currStreamCardId) + 1;
|
|
|
const compId = await this.store.insertDesignContent(compKey, index);
|
|
@@ -62,33 +56,35 @@ export const editActions = EditorModule.action({
|
|
|
compKey,
|
|
|
this.store.currStreamCard
|
|
|
);
|
|
|
- this.actions.pickComp(compId);
|
|
|
- this.actions.setCompPositionFloat(this.store.currComp);
|
|
|
-
|
|
|
+ const addedComp = this.store.compMap[compId]
|
|
|
+ this.actions.setCompPositionFloat(addedComp);
|
|
|
+
|
|
|
+ this.controls.selectCtrl.selecteObjs([new CompObject(addedComp)])
|
|
|
},
|
|
|
+
|
|
|
// 切换当前组件
|
|
|
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;
|
|
|
- }
|
|
|
+ // 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);
|
|
@@ -97,7 +93,6 @@ export const editActions = EditorModule.action({
|
|
|
if (this.store.currCompId == compId) {
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
this.store.setCurrComp(compId);
|
|
|
if (this.store.currCompId == this.store.currStreamCardId) {
|
|
|
this.controls.transferCtrl.destroy();
|