|
@@ -638,10 +638,27 @@ export const editActions = EditorModule.action({
|
|
|
},
|
|
|
// 设置组件层级
|
|
|
setCompLayer(comp: DesignComp, offset: number) {
|
|
|
- comp.layout.zIndex = Math.min(
|
|
|
- Math.max((comp.layout.zIndex || 0) + offset, 0),
|
|
|
- 99
|
|
|
- );
|
|
|
+ const cards = (this.store.currStreamCard.children.default || []);
|
|
|
+ const i = cards.indexOf(comp.id);
|
|
|
+ if (i == -1) return;
|
|
|
+
|
|
|
+ if (offset < 0) {//向下移动
|
|
|
+ if (i== 0) return;
|
|
|
+ const temp = cards[i-1];
|
|
|
+ cards[i-1] = comp.id;
|
|
|
+ cards[i] = temp;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (i == cards.length -1) return;
|
|
|
+ const temp = cards[i+1];
|
|
|
+ cards[i+1] = comp.id;
|
|
|
+ cards[i] = temp;
|
|
|
+
|
|
|
+ // comp.layout.zIndex = Math.min(
|
|
|
+ // Math.max((comp.layout.zIndex || 0) + offset, 0),
|
|
|
+ // 99
|
|
|
+ // );
|
|
|
},
|
|
|
//横向对齐
|
|
|
setAlignX(flag: 0 | 1 | 2 | 3) {
|