Hide a controller with `dat.gui`

127
February 13, 2020, at 01:50 AM

I have the following code for a simple GUI (also in jsfiddle.net):

import { GUI } from "https://unpkg.com/three@0.112.1/examples/jsm/libs/dat.gui.module.js";
var gui;
var settings = {
  toggle: true,
  slide: 0.0,
  child: 0.0,
}
function toggle() {
  if (!settings.toggle) {
    gui.__folders.Parent.hide();
  } else {
    gui.__folders.Parent.show();
  }
}
window.onload = function() {
  gui = new GUI();
  gui.add(settings, 'toggle').onChange(toggle);;
  gui.add(settings, 'slide', -1, 1);
  var folder = gui.addFolder('Parent');
  folder.add(settings, 'child', -1, 1);
  folder.open();
};

Note how I made the toggle button hide/show the Parent folder easily.

Is there a way I could do the same with a controller? In particular, could I make the toggle button hide/show the slide controller instead of the Parent folder?

Ideally, I should be able to do this using the slide name, instead of relying on the position where the controller is within the list of controllers in the GUI.

READ ALSO
Pass parameter to javascript function in Go template

Pass parameter to javascript function in Go template

I have the following in my Go's template

98
Load More data jumps up after loading data AngluarJS with fireFox

Load More data jumps up after loading data AngluarJS with fireFox

When I load dynamic data into my page using AngularJS, the page jumps to the top (The containing element) if I use EnablePromise functionThis happens with Firefox but not with Chrome

68
My Angular App works locally, but it gets an error on Heroku. Source Map URL: index.js.map

My Angular App works locally, but it gets an error on Heroku. Source Map URL: index.js.map

I can pull data from the JSON locally (when using ng serve) and modify the DOM with it, but not on Heroku

93