Disabled right-click, three.js

108 Views Asked by At

I made a website using react.js but somewhere in the process, the right-click was disabled. I noticed that first when I used three.js to add a 3d model as a glb file. I don't have much experience with three.js but I could add the model to the website. The only problem was when I clicked on the right, instead of opening the tab I was moving the model. Because of this, I removed all the code that loads and displays the model, but the problem doesn't solve. What can I do now? I thought I installed something with three.js that disabled right-click. I checked my browser settings, and all the code but didn't find anything that can cause this. Any idea?

1

There are 1 best solutions below

0
PaoAndreCM On

This happened to me too. I decided to comment out all the code and uncomment it line by line to find the culprit. Surprisingly, the line causing this issue is

const camera = new THREE.PerspectiveCamera( 45, canvas.width / canvas.height,0.1, 1000 );

I'm not sure why yet, but I'm 100% sure that line is the problem. I just installed an extension that allows me to enable right click. Not ideal but I don't know what else to do.