From 04f31c327e4a5eeb3ee52724d93e0b16939e13f0 Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Sat, 17 Sep 2022 07:41:24 -0400 Subject: [PATCH] Fixed scene highlighting whatever is under 0,0 on first render --- js/component/scene.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/component/scene.js b/js/component/scene.js index 9fdbd71..0819bbb 100644 --- a/js/component/scene.js +++ b/js/component/scene.js @@ -239,7 +239,13 @@ beestat.component.scene.prototype.add_raycaster_ = function() { this.raycaster_ = new THREE.Raycaster(); this.raycaster_.layers.set(beestat.component.scene.layer_visible); - this.raycaster_pointer_ = new THREE.Vector2(); + + /** + * Initialize a pointer representing the raycaster. Initialize it pointing + * way off screen instead of 0,0 so nothing starts thinking the mouse is + * over it. + */ + this.raycaster_pointer_ = new THREE.Vector2(10000, 10000); // TODO remove event listener on dispose document.addEventListener('mousemove', function(e) {