Jelajahi Sumber

Merge branch 'dev' of http://124.70.149.18:10880/lianghj/queenshow into spu3d

bianjiang 1 tahun lalu
induk
melakukan
7d741a8466

+ 2 - 0
src/modules/editor/components/CompUI/basicUI/Container/component.tsx

@@ -12,6 +12,7 @@ export const Component = defineComponent({
   props: {
     compId: string().isRequired,
     showMask: bool().def(false),
+    meta: bool().def(true),
   },
   setup(props) {
     const { helper, controls, store } = useEditor();
@@ -72,6 +73,7 @@ export const Component = defineComponent({
             compId={props.compId}
             style={containerScale}
             showMask={props.showMask}
+            meta={props.meta}
           >
             {comp.children.default?.map((compId, index) => {
               const compItem = helper.findComp(compId) as DesignComp;

+ 7 - 5
src/modules/editor/components/CompUI/basicUI/Curve/component.tsx

@@ -81,7 +81,7 @@ function parsePoints( points:number[][],  width:number, height:number) {
     let n = points.length;
     for(let i=0; i<n; i++) {
         const p = points[i]
-
+        
         const x = p[0]*width, y = p[1]*height;
 
           //绘制控制点的位置
@@ -177,10 +177,10 @@ export const Component = defineComponent({
             //判断是否
             console.log("dbclick=>xxxxx", ret);
             if (ret.clicked) {//点击删除
-                points.splice(ret.index, 1);
-                if (points.length < 2) {
+                if (points.length < 3) {
                     return;
                 }
+                points.splice(ret.index, 1);
 
             } else {
                 let next = ret.index + 1;
@@ -218,7 +218,7 @@ export const Component = defineComponent({
                 
                 const isDragingIndex = ret.pIndex;
 
-                const box = controls.selectCtrl.getCurrCardViewPortBox();
+                const box = controls.selectCtrl.getCurrCardBox();
 
                 const mvingPoint = !ret.clickCurve && !ret.clickLine
                 let initControlpLen :number | undefined = undefined;
@@ -229,6 +229,7 @@ export const Component = defineComponent({
 
                     const obj = controls.selectCtrl.objContainer;  
                     const cardX = e.clientX - box.left, cardY =  e.clientY - box.top;
+                    
                     const p = {x: cardX, y:cardY} as any;
                     obj.parent.worldTransform.applyInverse(p, p);
                     obj.parent.updateTransform();
@@ -236,7 +237,8 @@ export const Component = defineComponent({
                     const x = helper.pxToDesignSize(p.x), y =  helper.pxToDesignSize(p.y);
                     const offx = ( x - dragingX) / width;
                     const offy = ( y -  dragingY) / height;
-                    
+                    console.log("offxxxxxxxxxxxx=>", x);
+
                     if (ret.moving) {//移动所有
                         points.forEach((p,i)=>{
                             p[0] = initPoints[i][0] + offx;

+ 10 - 0
src/modules/editor/components/CompUI/basicUI/Curve/index.ts

@@ -30,6 +30,16 @@ export class CompCurveObj extends DesignCompObj<typeof CurveValue> {
     this.compKey = "Curve";
     this.layout.size = [750, 750];
   }
+  fromJson(data:any) {
+    super.fromJson(data);
+
+    console.log("--------------", this.value.points);
+    let hasEmpty = false;
+    this.value.points.forEach(item=>{
+      if (!item) hasEmpty = true;
+    })
+    if (hasEmpty) this.value.points = [];
+  }
 }
 
 export function createComp() {

+ 2 - 2
src/modules/editor/components/CompUI/basicUI/Page/component.tsx

@@ -150,13 +150,13 @@ export const Component = defineComponent({
 
           {store.isEditMode &&
             controls.screenCtrl.state.screen.pageMode == "short" &&
-            store.currStreamCard && (
+            controls.pageCtrl.currStreamCard && (
               // <div
               //   class="relative z-1000"
               //   // style={contextStyle}
               // >
               // </div>
-              <>{slots.Container?.([slots.CompItem?.(store.currStreamCard)])}</>
+              <>{slots.Container?.([slots.CompItem?.(controls.pageCtrl.currStreamCard)])}</>
             )}
 
           {/* 轮播组件 */}

+ 4 - 4
src/modules/editor/components/CompUI/basicUI/Text/TextToolComp.tsx

@@ -463,10 +463,10 @@ export const TextToolItem = defineComponent({
       }
     );
     watch(
-      () => store.currComp.value.text,
+      () => controls.pageCtrl.currComp.value.text,
       () => {
         editor = toRaw(controls.textEditorCtrl.state.currEditor);
-        if (!editor && store.currComp.compKey == "Text") {
+        if (!editor && controls.pageCtrl.currComp.compKey == "Text") {
           initCommands();
         }
       }
@@ -487,9 +487,9 @@ export const TextToolItem = defineComponent({
         if (!column?.dataIndex) {
           return;
         }
-        if (store.currComp.compKey != "Text") return;
+        if (controls.pageCtrl.currComp.compKey != "Text") return;
 
-        const compValue = store.currComp.value.text;
+        const compValue = controls.pageCtrl.currComp.value.text;
         if (tagsKey[column.dataIndex]) {
           const hasTag = compValue.indexOf(tagsKey[column.dataIndex]);
           if (hasTag != -1) {

+ 6 - 6
src/modules/editor/components/CompUI/basicUI/Text/TextToolForm.tsx

@@ -42,19 +42,19 @@ export const TextToolForm = defineComponent({
     };
 
     watch(
-      () => store.currComp.value.text,
+      () => controls.pageCtrl.currComp.value.text,
       () => {
         const editor = toRaw(controls.textEditorCtrl.state.currEditor);
-        if (!editor && store.currComp.compKey == "Text") {
+        if (!editor && controls.pageCtrl.currComp.compKey == "Text") {
           nextTick(() => {
             const element: HTMLElement | null = document.querySelector(
-              `#editor_${store.currComp.id}`
+              `#editor_${controls.pageCtrl.currComp.id}`
             );
             if (!element) {
               return;
             }
             const h = helper.pxToDesignSize(element.clientHeight);
-            const size: any = store.currComp.layout.size.slice(0);
+            const size: any = controls.pageCtrl.currComp.layout.size.slice(0);
             size[1] = h;
 
             // 组内text  更新组高度
@@ -62,8 +62,8 @@ export const TextToolForm = defineComponent({
               gizmo.selected.length == 1 &&
               gizmo.selected[0].comp.compKey == "Group"
             ) {
-              store.currComp.setSize(size[0], h);
-              helper.updateGroups(store.currComp.id);
+              controls.pageCtrl.currComp.setSize(size[0], h);
+              helper.updateGroups(controls.pageCtrl.currComp.id);
             } else {
               controls.selectCtrl.gizmo.selected[0]?.setSize(
                 designSizeToPx(size[0]),

+ 2 - 1
src/modules/editor/components/CompUI/basicUI/View.tsx

@@ -21,11 +21,12 @@ export const View = defineComponent({
     compId: string().isRequired,
     editlayer: bool().def(true),
     showMask: bool().def(false),
+    meta: bool().def(true),
   },
   emits: ["dblclick", "click"],
   setup(props, { slots, emit, attrs }) {
     const { store, actions, helper, controls } = useEditor();
-    const compRef = useCompRef(props.compId);
+    const compRef = useCompRef(props.compId, props.meta);
     const editorLayerRef = props.editlayer
       ? useCompEditLayerRef(props.compId)
       : ref();

+ 2 - 2
src/modules/editor/components/CompUI/basicUI/hooks.ts

@@ -1,7 +1,7 @@
 import { useEditor } from "@/modules/editor";
 import { inject, onMounted, provide, ref } from "vue";
 
-export function useCompRef(compId: string) {
+export function useCompRef(compId: string, writeMetaData = true) {
   const compRef = ref();
   const { store, helper, controls } = useEditor();
 
@@ -13,7 +13,7 @@ export function useCompRef(compId: string) {
 
   onMounted(() => {
     const comp = helper.findComp(compId);
-    if (comp) {
+    if (comp && writeMetaData) {
       Object.defineProperties(comp, {
         $el: {
           value: compRef.value,

+ 8 - 8
src/modules/editor/components/CompUI/customUI/Cards/Card2/component.tsx

@@ -12,13 +12,13 @@ export const Component = createUIComp({
     compId: string().isRequired,
   },
   setup(props) {
-    const { store  , helper} = useEditor();
+    const { store  , helper, controls} = useEditor();
     const { children } = useCompData(props.compId);
 
     const designToNaturalSize = helper.designToNaturalSize;
     function fixedSize(id:string, w:number, h:number)
     { 
-        const item1Comp = store.compMap[id]
+        const item1Comp = controls.pageCtrl.compMap[id]
         if ( !item1Comp ) return;
 
         if (item1Comp.layout.size) {
@@ -31,17 +31,17 @@ export const Component = createUIComp({
     }
 
     function upgrade() {
-      const bgComp = store.compMap[children.bgImg]
+      const bgComp = controls.pageCtrl.compMap[children.bgImg]
       if (bgComp.layout.size == undefined || bgComp.layout.size[1] != 464) {
         bgComp.layout.size = [750, 464]
       }
-      const item1Comp = store.compMap[children.item1]
+      const item1Comp = controls.pageCtrl.compMap[children.item1]
       if ( !item1Comp.layout.transformMatrix) {
         item1Comp.layout.transformMatrix = "matrix(1,0,0,1, 40, 170)"
  
       }
 
-      const item2Comp = store.compMap[children.item2]
+      const item2Comp = controls.pageCtrl.compMap[children.item2]
       if ( !item2Comp.layout.transformMatrix) {
         
         item2Comp.layout.transformMatrix = "matrix(1, 0, 0, 1, 153, 136)",
@@ -49,21 +49,21 @@ export const Component = createUIComp({
         item2Comp.layout.position = "absolute";
       }
 
-      const item3Comp = store.compMap[children.item3]
+      const item3Comp = controls.pageCtrl.compMap[children.item3]
       if ( !item3Comp.layout.transformMatrix) {
         item3Comp.layout.transformMatrix = "matrix(1, 0, 0, 1, 269, 100)",
         //@ts-ignore
         item3Comp.layout.position = "absolute";
       }
 
-      const text1Comp = store.compMap[children.text1]
+      const text1Comp = controls.pageCtrl.compMap[children.text1]
       if ( !text1Comp.layout.transformMatrix) {
         text1Comp.layout.transformMatrix = "matrix(1,0,0,1,0, 50)",
         //@ts-ignore
         text1Comp.layout.position = "absolute";
       }
 
-      const text2Comp = store.compMap[children.text2]
+      const text2Comp = controls.pageCtrl.compMap[children.text2]
       if ( !text2Comp.layout.transformMatrix) {
         text2Comp.layout.transformMatrix = "matrix(1,0,0,1, 0, 248)",
         //@ts-ignore

+ 1 - 0
src/modules/editor/components/Viewport/Content/index.tsx

@@ -110,6 +110,7 @@ export default defineUI({
                         <div class="pointer-events-none">
                           <Comp
                             compId={c.id}
+                            meta={false}
                             style={{
                               transformOrigin: "0 0",
                               pointerEvent: "none",

+ 3 - 2
src/modules/editor/components/Viewport/Header/PreviewDesignModal.tsx

@@ -17,9 +17,10 @@ export default defineComponent({
   },
   setup(props) {
     const editor = initEditor();
-    const { helper, controls } = editor;
+    const { store, helper, controls } = editor;
     const page = controls.pageCtrl;
-    
+    store.setMode("preview");
+
     controls.pageCtrl.setDesignData(cloneDeep(props.data));
 
     const pageRef = ref();

+ 7 - 7
src/modules/editor/controllers/CropperCtrl/index.ts

@@ -52,7 +52,7 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
             
             if (name == "Cross") { //取消操作
                 const compId = this.state.compId
-                const imgComp = this.store.compMap[compId];
+                const imgComp = this.controls.pageCtrl.compMap[compId];
                 imgComp.value.matrix = initMtrx;
                 imgComp.value.w = initW;
                 imgComp.value.h = initH;
@@ -69,13 +69,13 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
             const lastMatrix = this.lastValue.matrix;
             history.record({
                 undo: ()=> {
-                    const imgComp = this.store.compMap[compId];
+                    const imgComp = this.controls.pageCtrl.compMap[compId];
                     imgComp.value.matrix = initMtrx;
                     imgComp.value.w = initW;
                     imgComp.value.h = initH;
                 },
                 redo: ()=> {
-                    const imgComp = this.store.compMap[compId];
+                    const imgComp = this.controls.pageCtrl.compMap[compId];
                     imgComp.value.matrix = lastMatrix;
                     imgComp.value.w = lastW;
                     imgComp.value.h = lastH;
@@ -89,7 +89,7 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
         let tmpM2 = new Matrix();
 
         this.modifyCtrl.on("change", (dtx:number, dty:number)=>{
-            const imgComp = this.store.compMap[this.state.compId];
+            const imgComp = this.controls.pageCtrl.compMap[this.state.compId];
 
             tmpM.copyFrom(this.modifyCtrl.objContainer.parent.worldTransform);
 
@@ -112,7 +112,7 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
 
     async croppImage(id:string) {
 
-        const imgComp = this.store.compMap[id]
+        const imgComp = this.controls.pageCtrl.compMap[id]
         if (imgComp.compKey != "Image") return;
 
         this.state.compId = id;
@@ -146,7 +146,7 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
 
     async croppImageImpl(id :string, isChild= true) {    
        
-       const imgComp = this.store.compMap[id]
+       const imgComp = this.controls.pageCtrl.compMap[id]
         const obj = new CompObject(imgComp);
         const w = obj.width, h = obj.height; //图片的宽高
         const r1 = h / w;
@@ -234,7 +234,7 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
         this.cancelTransform = ()=>{console.log("empty")};
 
         const compId = this.state.compId
-        const imgComp = this.store.compMap[compId];
+        const imgComp = this.controls.pageCtrl.compMap[compId];
         if (imgComp) {
             imgComp.value.matrix = this.initValue.matrix;
             imgComp.value.w = this.initValue.w;

+ 2 - 2
src/modules/editor/controllers/EditorCtrl/index.ts

@@ -229,13 +229,13 @@ export class EditorCtrl extends ModuleControl<EditorModule> {
     const parentb = parent.getBoundingClientRect();
 
     const designW =
-      this.helper.designSizeToPx(this.store.currStreamCard.layout.size[0]) + 40;
+      this.helper.designSizeToPx(this.controls.pageCtrl.currStreamCard.layout.size[0]) + 40;
     if (parentb.width < designW) {
       scale = parentb.width / designW;
     }
     this.setScale(scale);
 
-    const bound = this.store.currStreamCard.$el.getBoundingClientRect();
+    const bound = this.controls.pageCtrl.currStreamCard.$el.getBoundingClientRect();
 
     const left = parentb.left + (parentb.width - bound.width) / 2.0; //屏幕坐标位置
     const top = parentb.top + (parentb.height - bound.height) / 2.0;

+ 6 - 4
src/modules/editor/controllers/ReactCtrl/rxValue.ts

@@ -1,6 +1,7 @@
+import { cloneDeep } from "lodash";
+import { BehaviorSubject } from "rxjs";
+import { reactive } from "vue";
 import { HistoryController } from "./history";
-import {BehaviorSubject} from "rxjs";
-import { reactive } from  "vue";
 
 export class ValueSnap {
     Id:string;
@@ -128,7 +129,7 @@ class RxValue {
                     out[name] = obj[name].toJson();
                     return;
                 }
-                out[name] = obj._rxs[name].getValue().value;
+                out[name] = cloneDeep(obj._rxs[name].getValue().value);
             })
             return out;
         }
@@ -163,4 +164,5 @@ class RxValue {
     }
 }
 
-export {RxValue};
+export { RxValue };
+

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

@@ -244,7 +244,10 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
       
       //获取当前screen的配置
       const screenId = this.state.screen.useFor + this.state.screen.pageMode + this.state.screen.pageSizeType;
-      const screenCards =  ScreenCtrl.createScreenCards(this.store.compMap, page.rootPage);
+
+      const compMap = this.controls.pageCtrl.compMap;
+      const screenCards =  ScreenCtrl.createScreenCards(compMap, page.rootPage);
+      
       if (!page.designData.compScreenMap) page.designData.compScreenMap = {};
       page.designData.compScreenMap[screenId] = screenCards;
    }

+ 6 - 6
src/modules/editor/controllers/SelectCtrl/index.ts

@@ -83,7 +83,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
   _cardBox = {x:0,y:0,width: 0, height: 0, bottom: 0, top: 0, left: 0};
 
   getCurrCardViewPortBox() {//屏幕空间坐标clientX 转中间viewport空间
-    const box = this.store.currStreamCard.$el.getBoundingClientRect();
+    const box = this.controls.pageCtrl.currStreamCard.$el.getBoundingClientRect();
     const viewportbox = this.getViewPortBox();
     const _cardBox  = this._cardBox;
     _cardBox.x = box.x  - viewportbox.x;
@@ -98,7 +98,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
 
   _tempPos = {x: 0, y:0}
   viewportPos2DesignPos(clientX: number, clientY:number) {
-      const box = this.store.currStreamCard.$el.getBoundingClientRect();
+      const box = this.controls.pageCtrl.currStreamCard.$el.getBoundingClientRect();
       let scale = this.controls.editorCtrl.state.scale;
       this._tempPos.x = (clientX - box.left) / scale;
       this._tempPos.y = (clientY - box.top)  / scale;
@@ -113,10 +113,10 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
 
   
   getCurrCard() {
-    return this.store.currStreamCard;
+    return this.controls.pageCtrl.currStreamCard;
   }
   getCurrCardBox() {
-    return this.store.currStreamCard.$el.getBoundingClientRect();
+    return this.controls.pageCtrl.currStreamCard.$el.getBoundingClientRect();
   }
   getProjectId() {
     const page = this.controls.pageCtrl;
@@ -595,7 +595,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
 
 
     //@ts-ignore
-    const yoff = this.store.currStreamCard.$el.getBoundingClientRect().top - this.pageEl?.getBoundingClientRect().top;
+    const yoff = this.controls.pageCtrl.currStreamCard.$el.getBoundingClientRect().top - this.pageEl?.getBoundingClientRect().top;
     this.transferStyle.baseCardTop = yoff / s  + "px";
   
     this.transferStyle.showGizmo = true;
@@ -699,7 +699,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
   }
   //
   checkIntersect(compId: string, e: MouseEvent) {
-    const currCard = this.store.currStreamCard.$el;
+    const currCard = this.controls.pageCtrl.currStreamCard.$el;
     const page = this.controls.pageCtrl;
 
     const comp = page.designData.compMap[compId];

+ 6 - 6
src/modules/editor/controllers/TextEditorCtrl/index.ts

@@ -31,7 +31,7 @@ export class TextEditorCtrl extends ModuleControl<EditorModule> {
     }
     if (!this.state.currEditor) {
       let alink = `<a href="${res}"><span style="font-size:14px">${res}</span></a>`;
-      const compValue = this.store.currComp.value.text;
+      const compValue = this.controls.pageCtrl.currComp.value.text;
       const pTagReg = /(<(p|h2|h3)[\s\S]*?>)([\s\S]*?)(<\/(p|h2|h3)>)/gi;
       const blocks = compValue.match(pTagReg);
       if (!blocks) {
@@ -41,7 +41,7 @@ export class TextEditorCtrl extends ModuleControl<EditorModule> {
         pTagReg,
         `$1$3${alink}$4`
       );
-      this.store.currComp.value.setText(blocks.join(""));
+      this.controls.pageCtrl.currComp.value.setText(blocks.join(""));
       return;
     }
     const editor = toRaw(this.state.currEditor);
@@ -53,7 +53,7 @@ export class TextEditorCtrl extends ModuleControl<EditorModule> {
       this.addCompValueTags(key, e);
       return;
     }
-    const compValue = this.store.currComp.value.text;
+    const compValue = this.controls.pageCtrl.currComp.value.text;
 
     const pTagReg = /(<(p|h2|h3)[\s\S]*?>)([\s\S]*?)(<\/(p|h2|h3)>)/gi;
     const blocks = compValue.match(pTagReg);
@@ -73,7 +73,7 @@ export class TextEditorCtrl extends ModuleControl<EditorModule> {
 
       blocks[index] = stylesStr;
     });
-    this.store.currComp.value.setText(blocks.join(""));
+    this.controls.pageCtrl.currComp.value.setText(blocks.join(""));
 
     history.submit();
     console.log("changing....");
@@ -133,7 +133,7 @@ export class TextEditorCtrl extends ModuleControl<EditorModule> {
   }
 
   addCompValueTags(key: string, e: any) {
-    const compValue = this.store.currComp.value.text;
+    const compValue = this.controls.pageCtrl.currComp.value.text;
     const pTagReg = /(<(p|h2|h3)[\s\S]*?>)([\s\S]*?)(<\/(p|h2|h3)>)/gi;
     const blocks = compValue.match(pTagReg);
     if (!blocks) {
@@ -152,7 +152,7 @@ export class TextEditorCtrl extends ModuleControl<EditorModule> {
       blocks[index] = this.formatSortTags(spanStr, key, e);
     });
 
-    this.store.currComp.value.setText(blocks.join(""));
+    this.controls.pageCtrl.currComp.value.setText(blocks.join(""));
     history.submit();
     console.log("changing....");
   }

+ 17 - 12
src/modules/editor/module/actions/edit.tsx

@@ -275,8 +275,8 @@ export const editActions = EditorModule.action({
     }, 100);
   },
 
-  centerLastComp(event: MouseEvent) {
-    const currCardDom = this.store.currStreamCard.$el;
+  centerLastComp(event:MouseEvent) {
+    const currCardDom = this.controls.pageCtrl.currStreamCard.$el;
     const cardPoints = this.helper.getPointOffsetWith(event, currCardDom);
     const page = this.controls.pageCtrl;
     let selCtrl = this.controls.selectCtrl;
@@ -305,7 +305,11 @@ export const editActions = EditorModule.action({
       this.controls.editorCtrl.clickPickComp(compId);
       return;
     }
-    const compId = page.insertCompContainer(compKey, this.store.currStreamCard);
+
+    const compId = page.insertCompContainer(
+      compKey,
+      this.controls.pageCtrl.currStreamCard
+    );
 
     this.controls.editorCtrl.clickPickComp(compId);
   },
@@ -353,7 +357,7 @@ export const editActions = EditorModule.action({
   setSameSize(isWidth: boolean) {
     const selectCtrl = this.controls.selectCtrl;
     const gizmo = selectCtrl.objContainer;
-    const layout = this.store.currComp.layout;
+    const layout = this.controls.pageCtrl.currComp.layout;
 
     const w = this.controls.screenCtrl.getCurrScreenWidth();
     if (this.selected.length == 1) {
@@ -362,9 +366,10 @@ export const editActions = EditorModule.action({
       if (isWidth) {
         isSame = w == size[0];
         size[0] = w;
-      } else {
-        isSame = size[1] == this.store.currStreamCard.layout.size[1];
-        size[1] = this.store.currStreamCard.layout.size[1];
+      }
+      else {
+        isSame = size[1] == this.controls.pageCtrl.currStreamCard.layout.size[1]
+        size[1] = this.controls.pageCtrl.currStreamCard.layout.size[1];
       }
       if (!isSame) {
         layout.setSize(size);
@@ -455,7 +460,7 @@ export const editActions = EditorModule.action({
           ctrl.compMap[cp1.id] = cp1;
           ctrl.setCompPid(cp1.id, c.id);
           childs[index] = cp1.id;
-          deepCopy(cp);
+          deepCopy(cp1);
         });
       }
     };
@@ -466,7 +471,7 @@ export const editActions = EditorModule.action({
       news.push(cp1.id);
       ctrl.compMap[cp1.id] = cp1;
       ctrl.setCompPid(cp1.id, ctrl.currStreamCardId);
-      deepCopy(cp);
+      deepCopy(cp1);
     });
     this.actions.addComps(news);
 
@@ -508,13 +513,13 @@ export const editActions = EditorModule.action({
   },
 
   addComps(ids: string[]) {
-    const childs = this.store.currStreamCard.children.default.slice(0);
+    const childs = this.controls.pageCtrl.currStreamCard.children.default.slice(0);
     childs.push(...ids);
     this.controls.pageCtrl.currStreamCard.children.setDefault(childs);
   },
 
   ctrlAndA() {
-    const childrens = (this.store.currStreamCard.children.default || []).slice(
+    const childrens = (this.controls.pageCtrl.currStreamCard.children.default || []).slice(
       0
     );
     this.controls.selectCtrl.gizmo.selectObjs(childrens);
@@ -909,7 +914,7 @@ export const editActions = EditorModule.action({
       const objc = selectCtrl.objContainer;
       const box = objc.getBound();
 
-      const card = new CompObject(this.store.currStreamCard);
+      const card = new CompObject(this.controls.pageCtrl.currStreamCard);
       const cardBox = card.getBox();
 
       switch (flag) {

+ 2 - 2
src/modules/editor/module/actions/image.tsx

@@ -5,9 +5,9 @@ import PreviewImagesModal from "../../components/PreviewImagesModal";
 export const ImgCompActions = EditorModule.action({
   handleImageHotKey(key: string) {
     if (!this.store.isEditMode) return;
-    if (this.store.currComp?.compKey !== "Image") return;
+    if (this.controls.pageCtrl.currComp?.compKey !== "Image") return;
 
-    const value = this.store.currComp.value;
+    const value = this.controls.pageCtrl.currComp.value;
 
     return;
     // if (key == "w") {

+ 1 - 1
src/modules/editor/module/helpers/edit.ts

@@ -29,7 +29,7 @@ export const editHelpers = EditorModule.helper({
         if (!RootEditLayer) return;
      
         const r = RootEditLayer.getBoundingClientRect();
-        const comp = this.store.compMap[compId];
+        const comp = this.controls.pageCtrl.compMap[compId];
         const w = this.helper.designSizeToPx(comp.layout.size[0])
         const h = this.helper.designSizeToPx(comp.layout.size[1])
         const parent = document.createElement("div")

+ 1 - 12
src/modules/editor/module/stores/index.ts

@@ -33,18 +33,7 @@ export const store = EditorModule.store({
     isDisplay(state) {
       return state.mode === "display";
     },
-    compMap(state) {
-      return this.controls.pageCtrl.compMap;
-    },
-
-    currComp(state) {
-      return this.controls.pageCtrl.currComp;
-    },
-
-    currStreamCard(state) {
-      return this.controls.pageCtrl.currStreamCard;
-    },
-
+    
     previewImageList(state) {
       const res: string[] = [];
       let scope = this;

+ 2 - 2
src/modules/editor/objects/Toolbars/default.ts

@@ -284,14 +284,14 @@ export const toolbars = createToolbars({
       return gizmo.selected[0].comp.compKey == "Image";
     },
     onClick(comp) {
-      this.controls.cropCtrl.croppImage(this.store.currComp.id);
+      this.controls.cropCtrl.croppImage(this.controls.pageCtrl.currComp.id);
     },
   },
   //文本链接
   textLink: {
     component: TipIcons.TextLink,
     getVisible(comp) {
-      return this.store.currComp && this.store.currComp.compKey == "Text";
+      return this.controls.pageCtrl.currComp && this.controls.pageCtrl.currComp.compKey == "Text";
     },
     onClick(comp) {
       this.controls.textEditorCtrl.setLinkUrl();