yamho / dat-gui

Automatically exported from code.google.com/p/dat-gui
0 stars 0 forks source link

no idea how to remove folders! #21

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I really have no clue how to remove a folder from the gui. After a long search 
I did find out how remove single variables (by removing the controller, odd 
enough). I figured, since the folder itself is a lot like a dat.GUI object, I 
might be able to get rid of it with the destroy() function, bu that didn't work 
either. The tutorial doesn't cover this (I find that it is very incomplete at 
most) and there is no documentation at all. I would really like to see a 
complete tutorial that really covers everything I need to know to use every 
feature or a documentation that does so (or at least a reference page of all 
the functions that are meant to be used by the programmer of the application). 

Original issue reported on code.google.com by stevende...@gmail.com on 10 Jul 2012 at 11:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I fixed it by adding the following function to the gui prototype:

removeFolder: function(name) {
  this.__folders[name].close();
  this.__ul.removeChild(this.__folders[name].li);
  dom.removeClass(this.__folders[name].li, 'folder');
  this.__folders[name] = undefined;
  this.onResize();
},

This should work in every case since folders can be identified by name alone.

Original comment by stevende...@gmail.com on 16 Jul 2012 at 4:07

GoogleCodeExporter commented 8 years ago
I forgot to mention that the gui prototype has a li object which is asigned in 
addFolder. The removeFolder function would be neater if it checks first if the 
gui actually is a foldler.

Original comment by stevende...@gmail.com on 17 Jul 2012 at 10:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
this chain is a couple years old. I had to use the following to get it to 
remove (in case anyone else stumbles on this page)

function(name) {
    this.__folders[name].close();
    this.__folders[name].domElement.parentNode.parentNode.removeChild(this.__folders[name].domElement.parentNode);
    this.__folders[name] = undefined;
    this.onResize();
}

Works in chrome Version 39.0.2171.71 ...didn't test in other browsers

Original comment by noah.mar...@gmail.com on 1 Dec 2014 at 9:03