浏览代码

完成序列帧

gemercheung 2 年之前
父节点
当前提交
f088948e05

+ 35 - 19
packages/qjkankan-editor/public/static/template/customTooltip.xml

@@ -45,6 +45,9 @@
          trace('ser_frame::',get(framewidth));
          set(hotspot[get(hsp_name)].url,get(iconUrl));
          set(hotspot[get(hsp_name)].framewidth,get(framewidth));
+         set(hotspot[get(hsp_name)].frames,get(frameNumber));
+         crop_animation_r_stop(get(hsp_name));
+
          txtadd(hotspot[get(hsp_name)].onloaded,"trace('ser_frame1::',get(frameNumber));do_crop_animation(get(framewidth),get(framewidth),get(frameNumber));"););
         );
         
@@ -72,6 +75,8 @@
         registerattribute(animatiedOn, 1); 
         registerattribute(frameRate, calc(1.0 / %3)); 
         set(crop, '0|0|%1|%2'); 
+        clearinterval(calc('crop_anim_' + name));
+  
         if(frameRate GE 0,
         setinterval(
             calc('crop_anim_' + name),
@@ -81,12 +86,12 @@
                 if(frame GE frames, if(onlastframe !== null, onlastframe() ); set(frame,0); );
                 mod(xpos,frame, xframes); 
                 div(ypos, frame, xframes);
-                
+                trace('onging::',get(frames));
                 Math.floor(ypos);
                 mul(xpos, %1);
                 mul(ypos, %2); 
                 calc(crop, xpos +'|' + ypos + '|%1|%2');
-                <!-- trace('onging::',get(crop)); -->
+             
                 if(animatiedOn == 0, 
                  clearinterval(calc('crop_anim_' + name));
                 );
@@ -98,23 +103,30 @@
         );
         );   
 	</action>
+    <action name="crop_animation_r_stop">
+      set(cur,%1);
+      tolower(cur, cur);
+      set(curIn,  calc('crop_anim_r_' + cur));
+      clearinterval(curIn); 
+    </action>
     
     <action name="crop_animation_reapply">
-        txtadd(cur,'',%1);
+        set(cur,%1);
         tolower(cur, cur);
         txtadd(frameRate,'',%2);
+        copy(frames, hotspot[get(cur)].frames);
+        copy(xframes, hotspot[get(cur)].xframes);
+        copy(yframes, hotspot[get(cur)].yframes);
         set(frame,0);
-        set(curIn,  calc('crop_anim_' + cur));
+        set(curIn,  calc('crop_anim_r_' + cur));
         clearinterval(curIn); 
         if(get(frameRate) GE 0,
            setinterval(curIn,
             get(frameRate),
-            copy(frames, hotspot[get(hsp_name)].frames);
-            copy(xframes, hotspot[get(hsp_name)].xframes);
-            copy(yframes, hotspot[get(hsp_name)].yframes);
-            copy(on, hotspot[get(hsp_name)].on);
-            copy(framewidth, hotspot[get(hsp_name)].framewidth);
             inc(frame);
+            copy(on, hotspot[get(cur)].on);
+            copy(framewidth, hotspot[get(cur)].framewidth);
+            <!-- trace('replay-crop::',get(frames));  -->
             if(frame GE frames, set(frame,0); );
             mod(xpos,frame, xframes); 
             div(ypos, frame, xframes);
@@ -123,7 +135,6 @@
             mul(ypos,framewidth); 
             if(animatiedOn == 0, clearinterval(curIn););
             calc(crop, xpos +'|' + ypos + '|'+framewidth +'|' + framewidth);
-            trace('replay-crop::',get(frames)); 
             copy(hotspot[get(hsp_name)].crop,crop);
         );
         );
@@ -413,19 +424,24 @@
        <!-- 序列化类型编辑 -->
         if(get(hsp_type) == 2, 
          indexoftxt(index, get(iconUrl), 'image_place_holder.png');
-         trace('frameNumber::',get(frameNumber));
-         trace('framewidth::',get(framewidth));
-         trace('duration::',get(duration));
+ 
          if(get(index) GT -1,set(hotspot[get(hsp_name)].animatiedOn,0); set(hotspot[get(hsp_name)].frames,-1););
          ifnot(get(index) GT -1, 
-          set(hotspot[get(hsp_name)].animatiedOn,1);
+        
+          set(hotspot[get(hsp_name)].animatiedOn,0);
           set(hotspot[get(hsp_name)].frames,get(frameNumber));
           calc(frameRate, duration / frameNumber);
-          trace('frameRate::',get(frameRate));
+
           set(hotspot[get(hsp_name)].frameRate,get(frameRate));
-          <!-- set(hotspot[get(hsp_name)].on,get(frameRate)); -->
-          crop_animation_reapply(get(hsp_name),get(frameRate),get(frameNumber));
-      
+
+          trace('frameRate::',get(frameRate));
+          trace('frameNumber::',get(frameNumber));
+          trace('framewidth::',get(framewidth));
+          trace('duration::',get(duration));
+        
+         crop_animation_reapply(get(hsp_name),get(frameRate),get(frameNumber));
+          <!-- do_crop_animation(get(hsp_name),get(frameRate),get(frameNumber)); -->
+        <!-- do_crop_animation(get(framewidth),get(framewidth),get(frameNumber));"); -->
          );
         );
      
@@ -435,7 +451,7 @@
         set(layer[get(hsDot)].visible,false);
   
        );
-   
+      
 
 </action>
 

+ 1 - 1
packages/qjkankan-editor/src/core/hotspot.js

@@ -98,7 +98,7 @@ const coverImageconPart = (origin) => {
 const coverSerialFrame = (origin) => {
     const duplicate = structuredClone(initState);
     const defaultImage = config.getStaticResource('/panoassets/images/hotspot/image_place_holder.png');
-    console.log('defaultImage', defaultImage);
+    // console.log('defaultImage', defaultImage);
     duplicate.id = origin.name;
     duplicate.title = origin.hotspotTitle;
     duplicate.ath = origin.ath;

+ 1 - 0
packages/qjkankan-editor/src/views/hotspot/EditPanel.vue

@@ -591,6 +591,7 @@ export default {
 
     cancel() {
       this.$store.commit("SetHotspot", this.backupHotSpot);
+      console.log('cancel',this.backupHotSpot);
       this.$emit("close", {
         type: this.editTitle == this.$i18n.t("hotspot.edit") ? "edit" : "add",
         data: this.backupHotSpot,

+ 4 - 1
packages/qjkankan-editor/src/views/hotspot/hotspotIconType/serial_frame.vue

@@ -109,11 +109,13 @@ export default {
   watch: {
     "hotspot.serialFrameInfo.img": {
       handler(vNew) {
+        console.error('vNew',vNew);   
         if (vNew && vNew.length > 0) {
           this.calcFrameData();
         }
       },
       immediate: true,
+      deep:true
     },
     frameHeight: {
       handler() {
@@ -140,7 +142,7 @@ export default {
     handleSubmitFromMaterialSelector(data) {
       this.isShowSelectionWindow = false;
       this.hotspot.serialFrameInfo.img = data[0].icon;
-      this.computeFrameHeight();
+      this.calcFrameData();
     },
     computeFrameHeight() {
       this.frameHeight = 0;
@@ -157,6 +159,7 @@ export default {
       }, 200);
     },
     calcFrameData() {
+      console.log('calcFrameData');
       setTimeout(() => {
         try {
           this.frameHeight = this.$refs["serial-frame-preview"].naturalHeight;