liwei 1 éve
szülő
commit
f547f31d09

+ 4 - 1
src/modules/editor/controllers/ScreenCtrl/index.ts

@@ -36,7 +36,10 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
    get isLongPage() {
       return this.state.screen.pageMode == "long";
    }
-
+   get currScreenId() {
+      return this.state.screen.useFor + this.state.screen.pageMode + this.state.screen.pageSizeType;
+   }
+   
    initEvent() {
       if ( !this.store.isEditMode ) return;
       this.state.onScreenChanged(()=>this.updateAdapterState());

+ 7 - 3
src/modules/editor/module/actions/edit.tsx

@@ -16,6 +16,7 @@ const ctrlState = {
   selected: [] as string[],
   type: 0,  // 1 ctrlc 2 ctrlx
   cardId: "", //当前的卡片Id
+  screenId: "", //屏幕Id
   selWidth: 0,
   selX: 0,
   selY: 0
@@ -333,7 +334,7 @@ export const editActions = EditorModule.action({
         ctrlState.selected.push(c);
       }
     })
-
+    ctrlState.screenId = this.controls.screenCtrl.currScreenId;
     ctrlState.cardId = this.store.currStreamCardId;
     ctrlState.type = 1;
     const objc = this.controls.selectCtrl.objContainer as ObjsContainer;
@@ -408,7 +409,7 @@ export const editActions = EditorModule.action({
 
     ctrlState.cardId = this.store.currStreamCardId;
     ctrlState.type = 2;
-    
+    ctrlState.screenId = this.controls.screenCtrl.currScreenId;
     const objc = this.controls.selectCtrl.objContainer as ObjsContainer;
     ctrlState.selWidth = this.helper.pxToDesignSize(objc.width);
     objc.setPivot(0);
@@ -475,7 +476,10 @@ export const editActions = EditorModule.action({
           this.controls.selectCtrl.translate(0, pox.y - ctrlState.selY);
           return;
       }
-      this.controls.selectCtrl.translate(20, 20);
+
+      if (ctrlState.screenId == this.controls.screenCtrl.currScreenId) {
+        this.controls.selectCtrl.translate(20, 20);
+      }
     }, 100);
   },
 

+ 0 - 7
src/modules/editor/module/stores/index.ts

@@ -179,7 +179,6 @@ export const store = EditorModule.store({
     },
 
     deleteComp(compId: string) {
-      const { compMap } = this.store.designData;
       const parentComp = this.helper.findParentComp(compId);
       let deleteOK = false;
       if (parentComp) {
@@ -196,12 +195,6 @@ export const store = EditorModule.store({
       }
 
       if (deleteOK) {
-        //不删除孩子节点
-        // const comp = this.helper.findComp(compId) as DesignComp;
-        // const ids = comp.getChildIds();
-        // [compId, ...ids].forEach((id) => {
-        //   delete compMap[id];
-        // });
         delete this.store.compPids[compId];
       }
     },