Skip to content

dat.GUI don't show options with function variables #340

@anzakhar

Description

@anzakhar

I'm trying to create an options menu to select the value of a function variable with dat.GUI.

In the 0.7.8 version of dat.GUI this code works - menu items after the 'func' label are displayed enter image description here

but in the newest version (0.7.9) it does not work - menu items after the 'func' label are not displayed enter image description here

Why is that?

function func1() {
  alert('function1');
}

function func2() {
  alert('function2');
}

function init() {
  // setup the control gui
  const controls = new function () {
    this.func = func1;
  };

  const gui = new dat.GUI();

  gui.add(controls, 'func', {
    function1: func1, 
    function2: func2
  })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions