From 41dfd4465a63d2705e234087bbff8e4f002739b8 Mon Sep 17 00:00:00 2001 From: Kevin Levron Date: Tue, 6 Apr 2021 19:17:32 +0200 Subject: [PATCH] clear callbacks onUnmounted --- package.json | 3 ++- src/components/physics/useCannon.js | 3 +-- src/core/Renderer.js | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index b23b8e9..2359770 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "troisjs", - "version": "0.2.1", + "version": "0.2.2", "scripts": { "dev": "vite", "build": "vite build", @@ -11,6 +11,7 @@ "@rollup/plugin-replace": "^2.3.3", "@vitejs/plugin-vue": "^1.2.1", "@vue/compiler-sfc": "^3.0.11", + "cannon": "^0.6.2", "eslint": "^7.7.0", "eslint-config-airbnb-base": "^14.2.0", "eslint-config-standard": "^14.1.1", diff --git a/src/components/physics/useCannon.js b/src/components/physics/useCannon.js index 3cb27e1..380cd27 100644 --- a/src/components/physics/useCannon.js +++ b/src/components/physics/useCannon.js @@ -28,6 +28,7 @@ export default function useCannon(options) { removeMesh, step, }; + return obj; function addMesh(mesh) { const shape = getShape(mesh.geometry); @@ -189,6 +190,4 @@ export default function useCannon(options) { iMatrix[index + 14] = position.z; iMatrix[index + 15] = 1; } - - return obj; } diff --git a/src/core/Renderer.js b/src/core/Renderer.js index 81dd73d..b40bc95 100644 --- a/src/core/Renderer.js +++ b/src/core/Renderer.js @@ -61,6 +61,8 @@ export default defineComponent({ this.onMountedCallbacks.forEach(c => c()); }, beforeUnmount() { + this.beforeRenderCallbacks = []; + this.afterRenderCallbacks = []; this.raf = false; this.three.dispose(); },