Continuing the discussion from Why mouse is not work on canvas and work on html tag see this video:
Depend on the listerners
Like for tag document.querySelector(’#div’).addEventListner(‘onmousemove’, action,false)
This is for an element
for canvas do like this
document.querySelector(’#canvas).addEventListner(‘onmousemove’, action,false)
Here #canvas is the id of your canvas
i try to this but not work
document.addEventListener(“mouseover”, onDocumentMouseMove, false);
function onDocumentMouseMove(e) {
sprite.position.set(e.clientX, e.clientY - 20, 0);
mouse.x = (e.clientX / window.innerWidth) * 2 - 1;
mouse.y = -(e.clientY / window.innerHeight) * 2 + 1;
}
can your suggest for mouse hover on 3D object and see message of 3D object name
like this link in house inside loacation symbol is hover then see message
Why mouse is not work on canvas and work on html tag […]
If you are using OrbitControls - they do likely hijack the mouse events of the canvas element.
You can do that using CSS2DRenderer and a Raycaster, for example.
solve without use css2drenderer
but label is not 1s in none
i will set this
clearTimeout(
setTimeout(() => {
span.style.display = “none”;
}, 1000)
);