mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
Initial files
This commit is contained in:
parent
c3021baa2f
commit
8126a0cf4b
24
demo.html
24
demo.html
@ -8,17 +8,27 @@ var controllableObject =
|
||||
"numberProperty": 20,
|
||||
"anotherNumberProperty": 0,
|
||||
"textProperty": "a string",
|
||||
"booleanProperty": false
|
||||
"booleanProperty": false,
|
||||
"functionProperty": function() {
|
||||
alert("hi");
|
||||
},
|
||||
};
|
||||
|
||||
// Creates a number box
|
||||
GUI.add(controllableObject, "numberProperty");
|
||||
|
||||
// Creates a slider (min, max)
|
||||
GUI.add(controllableObject, "anotherNumberProperty", -100, 100);
|
||||
|
||||
// Creates a text field
|
||||
GUI.add(controllableObject, "textProperty");
|
||||
|
||||
// Creates a checkbox
|
||||
GUI.add(controllableObject, "booleanProperty");
|
||||
|
||||
// Creates a button
|
||||
GUI.add(controllableObject, "functionProperty");
|
||||
|
||||
/*
|
||||
GUI.number(controllableObject, "numberProperty");
|
||||
GUI.number(controllableObject, "anotherNumberProperty", -100, 100);
|
||||
GUI.text(controllableObject, "textProperty");
|
||||
GUI.boolean(controllableObject, "booleanProperty");
|
||||
*/
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
27
gui.js
27
gui.js
@ -1,7 +1,30 @@
|
||||
var GUI = new function() {
|
||||
|
||||
this.add = function(a) {
|
||||
console.log(typeof a);
|
||||
|
||||
|
||||
var addHandlers = {
|
||||
|
||||
"number": function() {
|
||||
//
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
this.add = function() {
|
||||
|
||||
var object = arguments[0];
|
||||
var property = arguments[1];
|
||||
|
||||
var value = object[property];
|
||||
var type = typeof value;
|
||||
|
||||
if (addHandlers[type]) {
|
||||
|
||||
} else {
|
||||
// don't know how to handle this data type
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user