Trying to add event to Threejs canvas the events (onmousedown and onmouseup) seem to be broken only (onmousemove) works
let Canvas = document.querySelector("canvas");
window.onmousedown = function () {
console.log("hi am working");
}
}
some people ride that problem by pointer-events:none;
it works but it broke all threejs input DragControls.js & OrbitControls.js
will not work
Try
window.addEventListener(‘mousedown’, function() { console.log(‘eatingCherryPieIsNice’)
})
drcmda
3
there’s a bug in threejs controls where they call preventdefault and worse, stoppropagation for no reason. the latter stops other events as a race condition, so it could be that. three 127 will fix it Controls: Remove calls of stopPropagation(). by Mugen87 · Pull Request #21348 · mrdoob/three.js · GitHub
you could also try three-stdlib which fixes such things perhaps a little quicker GitHub - pmndrs/three-stdlib: Stand-alone library of threejs examples designed to run without transpilation in node & browser
Wow thank you that is working