mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
80 lines
1.9 KiB
HTML
80 lines
1.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
|
|
<script src="components/platform/platform.js"></script>
|
|
|
|
<link href="//fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
|
|
|
|
<link rel="import" href="elements/number-controller.html">
|
|
<link rel="import" href="elements/gui-panel.html">
|
|
<link rel="import" href="elements/gui-row.html">
|
|
|
|
</head>
|
|
<body touch-action="auto">
|
|
|
|
<!-- Added via DOM -->
|
|
|
|
<gui-panel>
|
|
|
|
<gui-row name="Number">
|
|
<gui-number></gui-number>
|
|
</gui-row>
|
|
|
|
<gui-row name="Number Controller">
|
|
<gui-number value="5000" min="0" max="10000"></gui-number>
|
|
</gui-row>
|
|
|
|
<gui-row name="Straddle Zero">
|
|
<gui-number min="-1" max="1" value="0"></gui-number>
|
|
</gui-row>
|
|
|
|
<gui-row name="Weird Range">
|
|
<gui-number min="-1" max="2" value="0"></gui-number>
|
|
</gui-row>
|
|
|
|
<gui-row name="Negative">
|
|
<gui-number min="-1" max="0" value="0"></gui-number>
|
|
</gui-row>
|
|
|
|
</gui-panel>
|
|
|
|
|
|
<script>
|
|
|
|
var object = { "x": 0 };
|
|
|
|
document.addEventListener("polymer-ready",function() {
|
|
|
|
// Added via JavaScript
|
|
|
|
var test1 = new NumberController();
|
|
test1.min = 0;
|
|
test1.max = 60;
|
|
test1.value = 50;
|
|
|
|
// document.body.appendChild( test1 );
|
|
|
|
var test2 = new NumberController();
|
|
test2.object = object
|
|
test2.property = "x";
|
|
|
|
Object.observe( object, function(changes) {
|
|
changes.forEach( function( c ) {
|
|
if ( c.name == "x" ) {
|
|
console.log( "object.x was changed to " + c.object.x, typeof c.object.x );
|
|
}
|
|
} );
|
|
} );
|
|
|
|
// document.body.appendChild( test2 );
|
|
// window.test2 = test2;
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html> |