I added a click event and a MouseDown event to the dom. When I click css2dobejct, only the MouseDown event will be triggered. What is the reason for this?
const dom = document.createElement("div");
dom.className = "pop";
const objlabel = new CSS2DObject(dom);
this.scene.add(objlabel);
dom.addEventListener("click", () => {
console.info("click");
});
dom.addEventListener("mousedown", () => {
console.info("mousedown");
});
Demo address
dom.addEventListener("pointerdown", () => {
console.info("click");
});
Hi!
When I make a CSS3DObject as follows:
element = document.createElement('div');
element.innerHTML = 'Test';
element.setAttribute('onclick', 'alert(1)');
const object = new CSS3DObject(element);
object.position.x = parseFloat(0);
object.position.y = parseFloat(0);
object.position.z = parseFloat(-150);
object.lookAt(this.camera.position);
this.scene.add(object);
Renderer:
this.renderer = new CSS3DRenderer();
this.renderer .setSize(window.innerWidth, window.innerHeight);…