liwei 1 年間 前
コミット
8f3c609223

+ 20 - 17
src/modules/editor/controllers/SelectCtrl/index.ts

@@ -246,19 +246,20 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
         }
         }
         if (!isClickSelRect) {
         if (!isClickSelRect) {
           //点击在选框之外
           //点击在选框之外
-  
-          if (!this._downClickedCompId) {
-            //没有点击到组件
-            const view = this.viewport?.getBoundingClientRect() as any;
-            const isOut =
-              e.clientX < view.left ||
-              e.clientX > view.right ||
-              e.clientY < view.top ||
-              e.clientY > view.bottom;
-            if (!isOut) {
-              this._state = MODE_SEL_RECT;
-            }
-          }
+          this._state = MODE_SEL_RECT;
+          
+          // if (!this._downClickedCompId) {
+          //   //没有点击到组件
+          //   const view = this.viewport?.getBoundingClientRect() as any;
+          //   const isOut =
+          //     e.clientX < view.left ||
+          //     e.clientX > view.right ||
+          //     e.clientY < view.top ||
+          //     e.clientY > view.bottom;
+          //   if (!isOut) {
+          //     this._state = MODE_SEL_RECT;
+          //   }
+          // }
           //else {//点击到选框之外的组件, 把时间放到mouseup 时相应.
           //else {//点击到选框之外的组件, 把时间放到mouseup 时相应.
           //   this._state = MODE_MOVING;
           //   this._state = MODE_MOVING;
           //   const obj = this.compMap[comps[0].id];
           //   const obj = this.compMap[comps[0].id];
@@ -515,11 +516,13 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       //选择空间转 streamCard空间
       //选择空间转 streamCard空间
       const card = this.store.currStreamCard;
       const card = this.store.currStreamCard;
       const box = card.$el.getBoundingClientRect();
       const box = card.$el.getBoundingClientRect();
+      const s = this.controls.editorCtrl.state.scale;
+
       this.rectSelect(
       this.rectSelect(
-        this._lastSelRect[0] - box.left,
-        this._lastSelRect[1] - box.top,
-        this._lastSelRect[2],
-        this._lastSelRect[3],
+        (this._lastSelRect[0] - box.left)/s,
+        (this._lastSelRect[1] - box.top) / s,
+        this._lastSelRect[2] / s,
+        this._lastSelRect[3] / s,
         e
         e
       );
       );
     }
     }

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

@@ -538,6 +538,13 @@ export const editActions = EditorModule.action({
     try {
     try {
       // 清除无用组件
       // 清除无用组件
       this.helper.clearUnusedComps(this.store.designData.compMap);
       this.helper.clearUnusedComps(this.store.designData.compMap);
+      const c = this.controls.screenCtrl;
+
+      const root = this.helper.findRootComp() as DesignComp;
+      root.value.useFor = c.state.useFor;
+      root.value.pageMode = c.state.pageMode;
+      root.value.pageSizeType = c.state.pageSizeType;
+
       // 封面截屏
       // 封面截屏
       if (!this.store.designData.thumbnail) {
       if (!this.store.designData.thumbnail) {
         await this.actions.updateThumbnailByScreenshot();
         await this.actions.updateThumbnailByScreenshot();

+ 6 - 1
src/modules/editor/module/actions/init.ts

@@ -29,7 +29,12 @@ export const initActions = EditorModule.action({
   async initDesign(id: string, isSys = false) {
   async initDesign(id: string, isSys = false) {
     const ret = await this.https.getDesignDetail(id, { isSys });
     const ret = await this.https.getDesignDetail(id, { isSys });
     this.store.setDesignData(ret.result);
     this.store.setDesignData(ret.result);
-    
+
+    const root = this.helper.findRootComp() as DesignComp;
+    this.controls.screenCtrl.state.useFor = root.value.useFor || "mobile";
+    this.controls.screenCtrl.state.pageMode = root.value.pageMode || "long";
+    this.controls.screenCtrl.state.pageSizeType = root.value.pageSizeType || "normal";
+  
     //设置组件父子关系
     //设置组件父子关系
     const ite = (root:any)=> {
     const ite = (root:any)=> {
       const cards = root.children?.default || [];
       const cards = root.children?.default || [];