DARLiiNG / dat-gui

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

error trying to remove a controller #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. remove one controller
2. add another controller
3. try to remove another controller

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
dat.gui 0.5.0

Please provide any additional information below.
The error is in the line 2032 in the source code of 0.5.0 version at remove 
function.

simply change:
this.__controllers.slice(this.__controllers.indexOf(controller), 1);
by
this.__controllers.splice(this.__controllers.indexOf(controller), 1);

I suggest also to add the next function

removeByProperty:function(propertyName)
      {
        var max=this.__controllers.length;
        var ind=-1;
        for (var n=0;n<max;n++)
        {
          if (this.__controllers[n].property==propertyName)
          {
            ind=n;
            break;
          }
        }
        if(ind>-1)
        {
          this.remove(this.__controllers[ind]);
        }
      },

Kind regards.

Original issue reported on code.google.com by ggala...@gmail.com on 30 Dec 2014 at 2:39