From cfbca7934bf5b60867dd83008c97950ab73710a4 Mon Sep 17 00:00:00 2001 From: Sander Moolin Date: Mon, 22 Mar 2021 15:40:33 -0400 Subject: [PATCH] fix custom onBeforeRender --- src/core/Raycaster.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/core/Raycaster.js b/src/core/Raycaster.js index ae4b9a6..a4c06d1 100644 --- a/src/core/Raycaster.js +++ b/src/core/Raycaster.js @@ -49,6 +49,14 @@ export default { } }, mounted() { + // add update method + this.three.onBeforeRender(this.update) + + // if we have a custom onBeforeRender method, assume + // the user is handling everything and exit setup + if (this.onBeforeRender) return; + + // prep non-reactive list of intersections this._intersects = [] @@ -65,9 +73,6 @@ export default { window.addEventListener('mousemove', this.onMouseMove) window.addEventListener('touchstart', this.onTouchMove) window.addEventListener('touchmove', this.onTouchMove) - - // add update method - this.three.onBeforeRender(this.update) }, methods: { update() {