mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Fixed options method to make sure the initial value is actually selected
This commit is contained in:
parent
7de4efc1c1
commit
08eb75861c
13
index.html
13
index.html
@ -6,13 +6,15 @@
|
||||
<link href="demo/demo.css" media="screen" rel="stylesheet" type="text/css"/>
|
||||
|
||||
<link href="src/DAT/GUI/gui.css" media="screen" rel="stylesheet"
|
||||
type="text/css"
|
||||
/>
|
||||
type="text/css"/>
|
||||
|
||||
<script type="text/javascript" src="src/DAT/GUI/GUI.js"></script>
|
||||
<script type="text/javascript" src="src/DAT/GUI/Slider.js"></script>
|
||||
<script type="text/javascript" src="src/DAT/GUI/Controller.js"></script>
|
||||
<script type="text/javascript" src="src/DAT/GUI/ControllerBoolean.js"></script>
|
||||
<script type="text/javascript" src="src/DAT/GUI/ControllerFunction.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="src/DAT/GUI/ControllerBoolean.js"></script>
|
||||
<script type="text/javascript"
|
||||
src="src/DAT/GUI/ControllerFunction.js"></script>
|
||||
<script type="text/javascript" src="src/DAT/GUI/ControllerNumber.js"></script>
|
||||
<script type="text/javascript" src="src/DAT/GUI/ControllerString.js"></script>
|
||||
|
||||
@ -78,7 +80,8 @@
|
||||
var element;
|
||||
for (var i = 0; (element = allElements[i]) != null; i++) {
|
||||
var elementClass = element.className;
|
||||
if (elementClass && elementClass.indexOf(className) != -1 && hasClassName.test(elementClass))
|
||||
if (elementClass && elementClass.indexOf(className) != -1 &&
|
||||
hasClassName.test(elementClass))
|
||||
results.push(element);
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,9 @@ DAT.GUI.Controller.prototype.options = function() {
|
||||
var opt = document.createElement('option');
|
||||
opt.innerHTML = i;
|
||||
opt.setAttribute('value', arr[i]);
|
||||
if (arguments[i] == this.getValue()) {
|
||||
opt.selected = true;
|
||||
}
|
||||
select.appendChild(opt);
|
||||
}
|
||||
} else {
|
||||
@ -83,6 +86,9 @@ DAT.GUI.Controller.prototype.options = function() {
|
||||
var opt = document.createElement('option');
|
||||
opt.innerHTML = arguments[i];
|
||||
opt.setAttribute('value', arguments[i]);
|
||||
if (arguments[i] == this.getValue()) {
|
||||
opt.selected = true;
|
||||
}
|
||||
select.appendChild(opt);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user