var domEvents = new THREEx.DomEvents(camera, view.domElement);
var div = document.createElement( 'div' );
div.setAttribute('data-remove','mesh1');
div.className = 'close-me';
var label = new THREE.CSS2DObject( div );
label.position.set( -(w / 2.1) , 0 , 0.1 );
mesh1.add( label );
domEvents.addEventListener(div, 'click', find, true);
function find(event){
alert('hey its me');
}
While trying to add a click event to a mesh object using THREEx, I encountered some console errors:
- Uncaught ReferenceError: THREEx is not defined
- threex.domevents.js: Uncaught ReferenceError: module is not defined
- Cannot read property 'addEventListener' of undefined
The THREEx CDN used is:
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="fa8e92889f9f82d79e95979f8c9f948e89bacbd4cad4ca">[email protected]</a>/threex.domevents.min.js"></script>
I would appreciate any help or guidance to resolve these issues.