I'm currently developing a 3D application using Three.js. One of the key components in this project is implementing a control system for the camera, which I have achieved using TrackballControls. However, as I tried to add an event listener, I encountered a strange error:
Unable to preventDefault inside passive event listener due to target being treated as passive.
. This error message includes a link to more information on the issue from this chromium website
While I understand the cause of the error, I am wondering if there are any workarounds to address this issue. The error seems to be originating from the line of code that reads: event.preventDefault();
Here's a snippet of the relevant code:
var control = new THREE.TrackballControls(camera);
control.addEventListener("change", render);
function render() {
renderer.render(scene, camera);
}
function update() {
renderer.render(scene, camera);
control.update();
requestAnimationFrame(update);
}
If anyone has encountered this issue before and has found a solution, I would greatly appreciate your assistance. Thank you in advance!