bill 5 tháng trước cách đây
mục cha
commit
c669ef2382
1 tập tin đã thay đổi với 9 bổ sung4 xóa
  1. 9 4
      src/views/animation/index.vue

+ 9 - 4
src/views/animation/index.vue

@@ -90,10 +90,12 @@ watchEffect((onCleanup) => {
   const frame = focusAM.value!.frames[activeAttrib.value.ndx];
   const frame = focusAM.value!.frames[activeAttrib.value.ndx];
   const am3d = amM.value.am;
   const am3d = amM.value.am;
   if (!am3d) return;
   if (!am3d) return;
-
-  am3d.bus.on("transformChanged", () => {
+  const updateMat = () => {
+    console.log("update mat", frame.id);
     frame.mat = JSON.parse(JSON.stringify(am3d.getModelPose()));
     frame.mat = JSON.parse(JSON.stringify(am3d.getModelPose()));
-  });
+  };
+
+  am3d.bus.on("transformChanged", updateMat);
 
 
   switch (frameAction.value) {
   switch (frameAction.value) {
     case "translate":
     case "translate":
@@ -106,7 +108,10 @@ watchEffect((onCleanup) => {
       am3d.enterScaleMode();
       am3d.enterScaleMode();
       break;
       break;
   }
   }
-  onCleanup(() => am3d.leaveTransform());
+  onCleanup(() => {
+    am3d.leaveTransform();
+    am3d.bus.off("transformChanged", updateMat);
+  });
 });
 });
 
 
 const updateFocus = (am?: AnimationModel) => {
 const updateFocus = (am?: AnimationModel) => {