Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anzakhar opened this issue Nov 9, 2024 · 0 comments
Open

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

anzakhar opened this issue Nov 9, 2024 · 0 comments

Comments

@anzakhar
Copy link

anzakhar commented Nov 9, 2024

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
  })
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant