'CSS2renderer is not working with webgl renderer
when we add css2renderer on time like label then my screen stuck seems like orbit control is not working .I’m using transform control in my project and its also not working when annotation label add on model with add listener.
let div = document.createElement( 'div' );
div.className = 'label';
div.textContent = '+';
div.type='button';
div.id='label6';
div.style.marginTop = '-1em'; div.addEventListener("mousedown",scope_AC.uiHandler.addConnectionBtns,false);
let label = new CSS2DObject( div );
label.position.copy(pos);
childModel.add( label );
scope_AC.modeler.labelRenderer.setSize( innerWidth, innerHeight ); scope_AC.modeler.labelRenderer.domElement.style.position = 'absolute';
scope_AC.modeler.labelRenderer.domElement.style.top = '15px';
scope_AC.modeler.labelRenderer.domElement.style.pointerEvents = 'none';
document.body.appendChild(scope_AC.modeler.labelRenderer.domElement );
Solution 1:[1]
The reason is that CSS2DRenderer is itself a DOM element above the canvas and thus the canvas never receives the mouse events. Set the labelRenderer as such:
labelRenderer.domElement.style.pointerEvents = 'none';
See also the demo here: https://codesandbox.io/s/css3d-tooltips-three-2l9v5?file=/index.js:1189-1243
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | IvanPeevski |