|
@@ -93,9 +93,11 @@ export const editActions = EditorModule.action({
|
|
|
const currComp = this.helper.findComp(compId) as DesignComp;
|
|
|
cb?.(currComp);
|
|
|
|
|
|
+ const w = this.controls.screenCtrl.getCurrScreenWidth();
|
|
|
+
|
|
|
//添加组件到当前选中的组件下面
|
|
|
let xOffset = this.helper.designSizeToPx(
|
|
|
- 375 - (currComp.layout.size?.[0] || 750) / 2
|
|
|
+ w / 2.0 - (currComp.layout.size?.[0] || w) / 2
|
|
|
);
|
|
|
const obj = new CompObject(currComp);
|
|
|
//没有选中组件添加到当前卡片最后
|
|
@@ -159,10 +161,11 @@ export const editActions = EditorModule.action({
|
|
|
}
|
|
|
|
|
|
const currComp = this.helper.findComp(addedId) as DesignComp;
|
|
|
+ const w = this.controls.screenCtrl.getCurrScreenWidth();
|
|
|
|
|
|
//添加组件到当前选中的组件下面
|
|
|
let xOffset = this.helper.designSizeToPx(
|
|
|
- 375 - (currComp.layout.size?.[0] || 750) / 2
|
|
|
+ w / 2.0 - (currComp.layout.size?.[0] || w) / 2
|
|
|
);
|
|
|
const obj = new CompObject(currComp);
|
|
|
|
|
@@ -208,9 +211,12 @@ export const editActions = EditorModule.action({
|
|
|
const cardPoints = this.helper.getPointOffsetWith(event, currCardDom);
|
|
|
const { currComp } = this.store;
|
|
|
let selCtrl = this.controls.selectCtrl;
|
|
|
+
|
|
|
+ const w = this.controls.screenCtrl.getCurrScreenWidth();
|
|
|
+
|
|
|
selCtrl.translate(
|
|
|
this.helper.designSizeToPx(
|
|
|
- 375 - (currComp.layout.size?.[0] || 750) / 2
|
|
|
+ w/2.0 - (currComp.layout.size?.[0] || w) / 2
|
|
|
),
|
|
|
cardPoints.y
|
|
|
);
|
|
@@ -316,8 +322,9 @@ export const editActions = EditorModule.action({
|
|
|
setSameSize(isWidth: boolean) {
|
|
|
const selectCtrl = this.controls.selectCtrl;
|
|
|
const objc = selectCtrl.objContainer as ObjsContainer;
|
|
|
+ const w = this.controls.screenCtrl.getCurrScreenWidth();
|
|
|
if (this.store.selected.length == 1) {
|
|
|
- if (isWidth) this.store.currComp.layout.size[0] = 750;
|
|
|
+ if (isWidth) this.store.currComp.layout.size[0] = w;
|
|
|
else this.store.currComp.layout.size[1] = this.store.currStreamCard.layout.size[1];
|
|
|
|
|
|
objc.updateSize();
|
|
@@ -672,6 +679,7 @@ export const editActions = EditorModule.action({
|
|
|
setAlignX(flag: 0 | 1 | 2 | 3) {
|
|
|
console.log("alignX");
|
|
|
const selectCtrl = this.controls.selectCtrl;
|
|
|
+ const w = this.helper.designSizeToPx(this.controls.screenCtrl.getCurrScreenWidth())
|
|
|
|
|
|
if (this.store.selected.length == 1) {
|
|
|
const objc = selectCtrl.objContainer as ObjsContainer;
|
|
@@ -681,10 +689,10 @@ export const editActions = EditorModule.action({
|
|
|
selectCtrl.translate(-box.left, 0);
|
|
|
break;
|
|
|
case 1:
|
|
|
- selectCtrl.translate(-(box.center.x - 187.5), 0);
|
|
|
+ selectCtrl.translate(-(box.center.x - w / 2.0), 0);
|
|
|
break;
|
|
|
case 2:
|
|
|
- selectCtrl.translate(375 - box.right, 0);
|
|
|
+ selectCtrl.translate(w - box.right, 0);
|
|
|
break;
|
|
|
}
|
|
|
return;
|
|
@@ -854,9 +862,10 @@ export const editActions = EditorModule.action({
|
|
|
objc.updateSize();
|
|
|
selectCtrl.upgateGizmoStyle();
|
|
|
},
|
|
|
+
|
|
|
// 宽度铺满
|
|
|
fullCompWidth(comp: DesignComp) {
|
|
|
- comp.layout.size[0] = 750;
|
|
|
+ comp.layout.size[0] = this.controls.screenCtrl.getCurrScreenWidth();
|
|
|
},
|
|
|
//
|
|
|
setCompAlign(comp: DesignComp, align: string) {
|