|
@@ -221,7 +221,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { onBeforeMount, ref, watch, onUnmounted } from 'vue';
|
|
|
+import { onBeforeMount, ref, watch, onUnmounted,onBeforeUnmount } from 'vue';
|
|
|
|
|
|
import { getPenTree } from '@/services/common';
|
|
|
import { deepClone } from '@meta2d/core';
|
|
@@ -409,10 +409,17 @@ onBeforeMount(() => {
|
|
|
// @ts-ignore
|
|
|
isPlaying.value = p?.currentAnimation;
|
|
|
}
|
|
|
-
|
|
|
+ meta2d.on('animateEnd', cancleAnimatePlayState);
|
|
|
penTree.value = getPenTree();
|
|
|
});
|
|
|
-
|
|
|
+onBeforeUnmount(() => {
|
|
|
+ meta2d.off('animateEnd', cancleAnimatePlayState);
|
|
|
+})
|
|
|
+const cancleAnimatePlayState = (pen) => {
|
|
|
+ if(pen.id === props.pen.id) {
|
|
|
+ isPlaying.value = -1;
|
|
|
+ }
|
|
|
+}
|
|
|
const watcher = watch(
|
|
|
() => props.pen.id,
|
|
|
() => {
|