Add reset button

This commit is contained in:
Rob L 2016-07-07 13:38:01 -04:00
parent dd97e1466b
commit ec3ed413bf
2 changed files with 10 additions and 0 deletions

View File

@ -14,6 +14,7 @@ render();
}); });
} }
function loadData(_callback) { function loadData(_callback) {
// Load Data (hopefully) before the rest of the place loads. // Load Data (hopefully) before the rest of the place loads.
var xmlhttp = new XMLHttpRequest(); var xmlhttp = new XMLHttpRequest();
@ -31,6 +32,12 @@ function loadData(_callback) {
} }
function reset_view() {
camera.position.set(-9300,50,550);
controls.target.x = jsonEmpire['UFP'].cenx;
controls.target.y = jsonEmpire['UFP'].ceny;
controls.target.z = jsonEmpire['UFP'].cenz;
}
function init() { function init() {
scene = new THREE.Scene(); scene = new THREE.Scene();

View File

@ -9,10 +9,13 @@
<style type="text/css"> <style type="text/css">
body { margin: 0; } body { margin: 0; }
canvas { width: 100%; height: 100% } canvas { width: 100%; height: 100% }
#reset-button { position: absolute; top:0; left:90%; background-color:#AAA; width: 50px; height:25px; color:#FFF; font-weight: bold; text-align:center;}
</style> </style>
</head> </head>
<body> <body>
<div id="container"></div> <div id="container"></div>
<div id="reset-button" onClick="reset_view();"> Reset </div>
</body> </body>
</html> </html>