Browser Error on changing the zoom level

I have just created a very simple 3D and to explore it I used TrackballControls. It works fine but when you go to developer’s tool console (Chrome) you see the following error (when you change the zoom level by mouse wheel):

image

I believe, I got the same error for OrbitControls as well. Any thought about this?

Um, I have seen this message in the past but I was never able to reproduce it :thinking:. For instance the official example seem to be fine:

https://threejs.org/examples/misc_controls_orbit.html

Do you mind sharing a link to an application or live example that triggers the message?

It seems the error occurs in Google Chrome. I don’t get the error in IE, Edge and Firefox.
Thanks for your attention.

I can reproduce on my system. It also can also see the error with this example:

https://threejs.org/examples/misc_controls_trackball

However, OrbitControls seems to be fine and both controls have similar ‘wheel’ event handlers :thinking:

Can you please try to setup TrackballControls like so and see what’s happening?

let controls = new THREE.TrackballControls(camera, renderer.domElement);

I assume the error is triggered because the event listener is added to document and not to the renderers canvas.

2 Likes

You are right! the event listener was the issue. Now it works fine.