Home > database >  Why div is not remove from label renderer in three.js
Why div is not remove from label renderer in three.js

Time:04-21

Hi its my third time since I have mentioned my question but I didn't get the proper solution .The problem is I create div in runtime but after once I click the div then function call and click but div is not remove event if I remove renderer.domElement remove from document body then its delete but I want to delete the renderer.domElement child delete which is not delete .Here is the code which I'm using in my project. Please check if three.js admins or members read this question then please don't ignore it I will be very thankful for help :)

JSFiddle: [https://jsfiddle.net/regeme786/vmx8uLd1/22/]

CodePudding user response:

If you want to remove an element from the CSS renderer, you have to remove it's instance of CSS2DObject. Not the element itself. So instead of doing:

element.remove();

you have to use the three.js API:

label.removeFromParent();
  • Related