Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drop down menu not work

I'm developing an easy web application, and I'm using two js libraries: dat.gui and three.js.

My problem is the drop down menu is locked. I can't open it.

// gui initialization (dat.gui)
function initGui() {

    var Options = function() {
        this.tenda = 'bar';
    };

    config = new Options();
    var gui = new dat.GUI();
    var subGui = gui.addFolder('Setting');
    subGui.open();

    // callbacks
    subGui.add( config, 'tenda', ['bar', 'pie', 'area']).
        onChange(
            function() {
                if (config.tenda === 'bar') { ... }
                else if (config.tenda === 'pie') { ... }
                else if (config.tenda === 'area') { ... }
            }
        );
};

Reading on the web, it seems to be a known issue, but in some examples, I see the drop down menus working well. I'm new to js, and I thought "maybe there is some scoping issue", so I put the initialization process inside a function that does the work. But the problem remains.

I'm working on Ubuntu/Chrome and Ubuntu/Firefox. You could check the entire code here, where I use check boxes instead of a drop down menu.

like image 802
optimusfrenk Avatar asked Nov 10 '22 10:11

optimusfrenk


1 Answers

I face the same problem. In my code, I have changed:

var controls = new THREE.OrbitControls(camera);

to

var controls = new THREE.OrbitControls(camera, renderer.domElement);
like image 62
Andrej Avatar answered Nov 14 '22 22:11

Andrej