- #1
aheight
- 321
- 109
Hi,
I am having problems attempting to create two folders in the dat.GUI interface for a Javascript program I'm writing. When I run the code below, the two labels for the folders do not show up. Rather I just get a single line "close control" menu heading and when I click it, I get another single line "open control" menu heading. Would should display are the two folder headings, "Display", and "Contours" and options to drop down the menu items in each folder. I was wondering if someone here could look at my code and help me with it? Maybe I may have a problem in my style sheet defining the containers, "moveGUI" and "table2"? I've included my stylesheet also below if someone is interested in looking at my code.
Thanks for reading,
I am having problems attempting to create two folders in the dat.GUI interface for a Javascript program I'm writing. When I run the code below, the two labels for the folders do not show up. Rather I just get a single line "close control" menu heading and when I click it, I get another single line "open control" menu heading. Would should display are the two folder headings, "Display", and "Contours" and options to drop down the menu items in each folder. I was wondering if someone here could look at my code and help me with it? Maybe I may have a problem in my style sheet defining the containers, "moveGUI" and "table2"? I've included my stylesheet also below if someone is interested in looking at my code.
Thanks for reading,
JavaScript:
var f1,f2;
function loadControlPanel()
{
displayController = function() { /* VarType | Display */
this.displayBorder = false;
this.contourNum=9;
this.theZvalue=0;
this.theXvalue=0;
this.theYvalue=0;
this.lightXvalue=0;
this.lightYvalue=0;
this.lightZvalue=0;
this.lightDirectionColorR=1;
this.lightDirectionColorG=1;
this.lightDirectionColorB=1;
this.ambientR=.4;
this.ambientG=.4;
this.ambientB=.4;
this.shading=true;
this.wireMesh=true;
};
theContourList=function() {
this.contourNum=1;
}
menuText = new displayController();
contourText=new theContourList();
gui = new dat.GUI({ autoPlace: false });
gui.domElement.id = 'table2';
f1 = gui.addFolder('Display');
f2 = gui.addFolder('Contours');
f1.add(menuText,'contourNum',1,10).step(1);
f1.add(menuText,'theZvalue',-1,1);
f1.add(menuText,'theXvalue',-10,10);
f1.add(menuText,'theYvalue',-10,10);
f1.add(menuText,'lightXvalue',-50,50);
f1.add(menuText,'lightYvalue',-50,50);
f1.add(menuText,'lightZvalue',-50,50);
f1.add(menuText,'ambientR',0,1);
f1.add(menuText,'ambientG',0,1);
f1.add(menuText,'ambientB',0,1);
f1.add(menuText,'lightDirectionColorR',0,1);
f1.add(menuText,'lightDirectionColorG',0,1);
f1.add(menuText,'lightDirectionColorB',0,1);
f1.add(menuText,'shading');
f1.add(menuText,'wireMesh');
f2.add(contourText,'contourNum',1,10).step(1);
customContainer = $('.moveGUI').append($(gui.domElement));
}
JavaScript:
<style>
a:link { color: #00c000 } /* unvisited links */
a:visited { color: #000c00 } /* visited links */
a:hover { color: #0000c0 } /* user hovers */
a:active { color: #00ccc0 } /* active links */
ul {
list-style-type: none;
margin: 0;
overflow: visible;
position: absolute;
top:0em;
left: 0em;
display: table;
}
#theFunctionDisplay {
margin: 0;
overflow: visible;
position: absolute;
bottom:1em;
left: 1em;
color: #ffaf50;
}
.dropbtn {
background-color: #ffAF50;
color: white;
padding: 2px;
font-size: 12px;
border: 1px solid #000000;
cursor: pointer;
width:200px;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #fff9f9;
min-width: 160px;
overflow: auto;
max-height: 465px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}.dropdown:hover .dropdown-content {
display: block;
width: 800px;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
#gui { position: absolute;
top: 3em;
left: 5em;
min-width: 160px;
overflow: auto;
max-height: 465px;
}
.fName {position: absolute;
bottom:3em;
left: 8em;
background-color: #f9f9f9;
}
.moveGUI{
position: absolute;
top: 0em;
right: 5em;
}
#myGraphicsCanvas {
position:absolute;
width: 100%;
height: 100%;
}
</style>