|
@@ -16,26 +16,33 @@ export const editActions = EditorModule.action({
|
|
this.store.currStreamCard.$el
|
|
this.store.currStreamCard.$el
|
|
);
|
|
);
|
|
const { currComp } = this.store;
|
|
const { currComp } = this.store;
|
|
- let selCtrl = this.controls.selectCtrl
|
|
|
|
- selCtrl.translate(this.helper.designSizeToPx(375 - (currComp.layout.size?.[0] || 750) / 2), cardPoints.y);
|
|
|
|
|
|
+ let selCtrl = this.controls.selectCtrl;
|
|
|
|
+ selCtrl.translate(
|
|
|
|
+ this.helper.designSizeToPx(375 - (currComp.layout.size?.[0] || 750) / 2),
|
|
|
|
+ cardPoints.y
|
|
|
|
+ );
|
|
this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
-
|
|
|
|
},
|
|
},
|
|
// 通过点击添加组件到画布
|
|
// 通过点击添加组件到画布
|
|
async clickCompToDesign(compKey: ICompKeys, cb?: (comp: DesignComp) => void) {
|
|
async clickCompToDesign(compKey: ICompKeys, cb?: (comp: DesignComp) => void) {
|
|
-
|
|
|
|
//点击默认都创建一个容器
|
|
//点击默认都创建一个容器
|
|
//创建容器
|
|
//创建容器
|
|
- const isCreatCard = compKey != "Text" && compKey != "Image" && compKey != "Video" && compKey != "Web3D";
|
|
|
|
|
|
+ const isCreatCard =
|
|
|
|
+ compKey != "Text" &&
|
|
|
|
+ compKey != "Image" &&
|
|
|
|
+ compKey != "Video" &&
|
|
|
|
+ compKey != "Web3D";
|
|
|
|
|
|
let yOffset = 0;
|
|
let yOffset = 0;
|
|
if (this.store.currCompId != this.store.currStreamCardId && !isCreatCard) {
|
|
if (this.store.currCompId != this.store.currStreamCardId && !isCreatCard) {
|
|
const bound = this.helper.getCardCompBound(this.store.currCompId);
|
|
const bound = this.helper.getCardCompBound(this.store.currCompId);
|
|
- yOffset = bound.y + bound.h
|
|
|
|
|
|
+ yOffset = bound.y + bound.h;
|
|
}
|
|
}
|
|
|
|
|
|
- if (isCreatCard) { //先创建卡片
|
|
|
|
- const index = this.store.streamCardIds.indexOf(this.store.currStreamCardId) + 1;
|
|
|
|
|
|
+ if (isCreatCard) {
|
|
|
|
+ //先创建卡片
|
|
|
|
+ const index =
|
|
|
|
+ this.store.streamCardIds.indexOf(this.store.currStreamCardId) + 1;
|
|
const compId = await this.store.insertDesignContent("Container", index);
|
|
const compId = await this.store.insertDesignContent("Container", index);
|
|
this.actions.pickComp(compId);
|
|
this.actions.pickComp(compId);
|
|
}
|
|
}
|
|
@@ -45,7 +52,9 @@ export const editActions = EditorModule.action({
|
|
|
|
|
|
//添加组件到当前选中的组件下面
|
|
//添加组件到当前选中的组件下面
|
|
const selectCtrl = this.controls.selectCtrl;
|
|
const selectCtrl = this.controls.selectCtrl;
|
|
- let xOffset = this.helper.designSizeToPx(375 - (currComp.layout.size?.[0] || 750) / 2);
|
|
|
|
|
|
+ let xOffset = this.helper.designSizeToPx(
|
|
|
|
+ 375 - (currComp.layout.size?.[0] || 750) / 2
|
|
|
|
+ );
|
|
selectCtrl.translate(xOffset, yOffset);
|
|
selectCtrl.translate(xOffset, yOffset);
|
|
selectCtrl.selecteObjs([]);
|
|
selectCtrl.selecteObjs([]);
|
|
|
|
|
|
@@ -53,8 +62,6 @@ export const editActions = EditorModule.action({
|
|
this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
this.helper.extendStreamCard(this.store.currStreamCardId);
|
|
},
|
|
},
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
// 添加组件到画布
|
|
// 添加组件到画布
|
|
async addCompToDesign(compKey: ICompKeys, index?: number) {
|
|
async addCompToDesign(compKey: ICompKeys, index?: number) {
|
|
if (!this.store.currStreamCardId) {
|
|
if (!this.store.currStreamCardId) {
|
|
@@ -73,10 +80,10 @@ export const editActions = EditorModule.action({
|
|
compKey,
|
|
compKey,
|
|
this.store.currStreamCard
|
|
this.store.currStreamCard
|
|
);
|
|
);
|
|
- const addedComp = this.store.compMap[compId]
|
|
|
|
|
|
+ const addedComp = this.store.compMap[compId];
|
|
this.actions.setCompPositionFloat(addedComp);
|
|
this.actions.setCompPositionFloat(addedComp);
|
|
|
|
|
|
- this.controls.selectCtrl.selecteObjs([new CompObject(addedComp)])
|
|
|
|
|
|
+ this.controls.selectCtrl.selecteObjs([new CompObject(addedComp)]);
|
|
},
|
|
},
|
|
|
|
|
|
// 切换当前组件
|
|
// 切换当前组件
|
|
@@ -199,7 +206,6 @@ export const editActions = EditorModule.action({
|
|
await this.controls.uploader.uploadBlobs(data);
|
|
await this.controls.uploader.uploadBlobs(data);
|
|
await this.https.createComp(data);
|
|
await this.https.createComp(data);
|
|
queenApi.messageSuccess("保存成功");
|
|
queenApi.messageSuccess("保存成功");
|
|
- this.controls.compUICtrl.initUserUI();
|
|
|
|
} catch (error: any) {
|
|
} catch (error: any) {
|
|
throw Exception.error(error.toString());
|
|
throw Exception.error(error.toString());
|
|
} finally {
|
|
} finally {
|