liwei 1 år sedan
förälder
incheckning
665c97b095

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

@@ -53,7 +53,8 @@ export const View = defineComponent({
       const isStreamCard = helper.isStreamCard(props.compId);
       const isGroupComp = helper.isGroupComp(props.compId);
       const isStreamChild = helper.isStreamCardChild(props.compId);
-
+      const cardId = helper.getCompTrees(props.compId)[1]?.id;
+      const cardIndex = store.streamCardIds.indexOf(cardId)
       const obj = new CompObject(store.compMap[props.compId]);
       const m = obj.worldTransform.clone();
       m.invert();
@@ -84,7 +85,7 @@ export const View = defineComponent({
       let aniStyles = "";
       if (
         comp.layout.anim &&
-        state.showAnimation &&
+        (state.showAnimation || store.shortPage.next == cardIndex ) &&
         ((!props.showMask && store.isEditMode) || !store.isEditMode)
       ) {
         aniStyles = `animate__animated animate__${comp.layout.anim} animate__delay-0.1s`;

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

@@ -9,7 +9,6 @@ export class AnimCtrl extends ModuleControl<EditorModule> {
   initEvent() {
      Effect.value(()=>this.store.shortPage).item((v)=>v.offset, (shortState)=>{
         console.log("xx")
-
         let next = shortState.index;
         if (shortState.offset < 0 ) {
             next = shortState.index + 1;
@@ -17,32 +16,30 @@ export class AnimCtrl extends ModuleControl<EditorModule> {
         if (shortState.offset > 0 ) {
             next = shortState.index - 1;
         }
-        this.initAnim();
         this.startAnim(next);
-
      }).run();
   }
   
   startAnim(index:number) {
-    const childrens = this.helper.findCardAllChildren(index);
-
-    console.log("start anim=>", index, childrens.length);
+    this.store.shortPage.next = index;
+    // const childrens = this.helper.findCardAllChildren(index);
 
-    childrens.forEach((c)=>{
-        const comp = this.helper.findComp(c) as DesignComp;
-        if (!comp.anim) return;
-        comp.anim.transition = false;
-        comp.layout.transformMatrix = comp.anim.startMatrix;
-        comp.layout.opacity = 0;
+    // console.log("start anim=>", index, childrens.length);
+    // childrens.forEach((c)=>{
+    //     const comp = this.helper.findComp(c) as DesignComp;
+    //     if (!comp.anim) return;
+    //     comp.anim.transition = false;
+    //     comp.layout.transformMatrix = comp.anim.startMatrix;
+    //     comp.layout.opacity = 0;
 
-        setTimeout(() => {
-            if (comp.anim) {
-                comp.anim.transition = true;
-                comp.layout.transformMatrix = comp.anim.endMatrix;
-                comp.layout.opacity = 1;
-            }
-        }, 100);
-    })
+    //     setTimeout(() => {
+    //         if (comp.anim) {
+    //             comp.anim.transition = true;
+    //             comp.layout.transformMatrix = comp.anim.endMatrix;
+    //             comp.layout.opacity = 1;
+    //         }
+    //     }, 100);
+    // })
   }
 
   

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

@@ -89,7 +89,7 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
 
    applyScreen() {
       const option = this.getRightScreenId();
-      if ( this.store.designData.compScreenMap?.[option.sreenId] ) {
+      if ( this.isScreenExit(option.sreenId) ) {
          this.restorScreenPage(option.sreenId);
          return;
       }
@@ -97,7 +97,7 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
       let n= AllSize.length;
       while(n--) {
          const screenId = option.device + option.pageMode + AllSize[n];
-         if ( this.store.designData.compScreenMap?.[screenId] ) {
+         if ( this.isScreenExit(screenId) ) {
             this.restorScreenPage(screenId);
             return;
          }
@@ -111,7 +111,7 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
          let n= AllSize.length;
          while(n--) {
             const screenId = option.device + "short" + AllSize[n];
-            if ( this.store.designData.compScreenMap?.[screenId] ) {
+            if ( this.isScreenExit(screenId) ) {
                this.restorScreenPage(screenId);
                return;
             }
@@ -160,6 +160,11 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
 
       this.state.safeFactor = this.state.screen.useFor == "pc" ? PCConst.factor : MobileConst.factor; 
    }
+   isScreenExit(screenId:string) {
+      return !!this.store.designData.compScreenMap[screenId] && 
+            this.store.designData.compScreenMap[screenId].length > 0 &&
+            this.store.designData.compScreenMap[screenId][1].children.length > 0;
+   }
 
    restorScreenPage(screenId = "") {
       if (!this.store.rootPage) return;
@@ -168,7 +173,7 @@ export class ScreenCtrl extends ModuleControl<EditorModule> {
       //获取当前screen的配置
       screenId = screenId ? screenId : this.state.screen.useFor + this.state.screen.pageMode + this.state.screen.pageSizeType;
       const screenCards = this.store.designData.compScreenMap[screenId] || [];
-      
+
       console.log("apply screen=>", screenId);
 
       //刷新当前card的配置

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

@@ -80,7 +80,7 @@ export class EditorModule extends ModuleRoot {
 
   onReady() {
     this.actions.init();
-    // this.controls.animCtrl.initEvent();
+    this.controls.animCtrl.initEvent();
     this.controls.screenCtrl.initEvent();
     this.controls.menuCtrl.initEvent();
     this.controls.categoryCtrl.init();

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

@@ -30,6 +30,7 @@ export const store = EditorModule.store({
       index: 0,
       offset: 0,
       isMoving: false,
+      next: -2,
     },
   }),
   getters: {