Save the intial state

This commit is contained in:
Thomas FORGIONE 2015-04-30 15:04:33 +02:00
parent 2e482079e1
commit 7eab3c03e4
4 changed files with 8 additions and 7 deletions

View File

@ -27,11 +27,11 @@ button.
<button class="btn btn-primary" id="full" style="margin-bottom: 10px; display: none;">Fullscreen</button> <button class="btn btn-primary" id="full" style="margin-bottom: 10px; display: none;">Fullscreen</button>
<button class="btn btn-primary" id="reset" style="margin-bottom:10px">Reset camera</button> <button class="btn btn-primary" id="reset" style="margin-bottom:10px">Reset camera</button>
<button class="btn btn-danger" id="undo" style="margin-bottom:10px"> <button class="btn btn-default" id="undo" style="margin-bottom:10px">
<span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span> <span class="glyphicon glyphicon-triangle-left" aria-hidden="true"></span>
</button> </button>
<button class="btn btn-danger" id="redo" style="margin-bottom:10px"> <button class="btn btn-default" id="redo" style="margin-bottom:10px">
<span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span> <span class="glyphicon glyphicon-triangle-right" aria-hidden="true"></span>
</button> </button>
<input type="checkbox" id="fullarrow" style="margin-bottom:10px"> <input type="checkbox" id="fullarrow" style="margin-bottom:10px">

View File

@ -134,7 +134,6 @@ PointerCamera.prototype.reset = function() {
this.position.copy(new THREE.Vector3(-8.849933489419644, 9.050627639459208, 0.6192960680432451)); this.position.copy(new THREE.Vector3(-8.849933489419644, 9.050627639459208, 0.6192960680432451));
this.target.copy(new THREE.Vector3(17.945323228767702, -15.156828589982375, -16.585740412769756)); this.target.copy(new THREE.Vector3(17.945323228767702, -15.156828589982375, -16.585740412769756));
this.anglesFromVectors(); this.anglesFromVectors();
this.save();
} }
PointerCamera.prototype.vectorsFromAngles = function() { PointerCamera.prototype.vectorsFromAngles = function() {

View File

@ -41,13 +41,13 @@ var redoElement = document.getElementById('redo');
function updateElements() { function updateElements() {
// Update icon // Update icon
if (!cameras.mainCamera().undoable()) { if (!cameras.mainCamera().undoable()) {
undoElement.className = "btn btn-danger"; undoElement.className = "btn btn-default";
} else { } else {
undoElement.className = "btn btn-primary"; undoElement.className = "btn btn-primary";
} }
if (!cameras.mainCamera().redoable()) { if (!cameras.mainCamera().redoable()) {
redoElement.className = "btn btn-danger"; redoElement.className = "btn btn-default";
} else { } else {
redoElement.className = "btn btn-primary"; redoElement.className = "btn btn-primary";
} }
@ -139,6 +139,7 @@ function init() {
var camera1 = new PointerCamera(50, container_size.width() / container_size.height(), 0.01, 100000, container); var camera1 = new PointerCamera(50, container_size.width() / container_size.height(), 0.01, 100000, container);
camera1.speed = 0.001; camera1.speed = 0.001;
camera1.reset(); camera1.reset();
camera1.save();
scene.add(camera1); scene.add(camera1);
cameras.push(camera1); cameras.push(camera1);

View File

@ -41,13 +41,13 @@ var redoElement = document.getElementById('redo');
function updateElements() { function updateElements() {
// Update icon // Update icon
if (!cameras.mainCamera().undoable()) { if (!cameras.mainCamera().undoable()) {
undoElement.className = "btn btn-danger"; undoElement.className = "btn btn-default";
} else { } else {
undoElement.className = "btn btn-primary"; undoElement.className = "btn btn-primary";
} }
if (!cameras.mainCamera().redoable()) { if (!cameras.mainCamera().redoable()) {
redoElement.className = "btn btn-danger"; redoElement.className = "btn btn-default";
} else { } else {
redoElement.className = "btn btn-primary"; redoElement.className = "btn btn-primary";
} }
@ -139,6 +139,7 @@ function init() {
var camera1 = new PointerCamera(50, container_size.width() / container_size.height(), 0.01, 100000, container); var camera1 = new PointerCamera(50, container_size.width() / container_size.height(), 0.01, 100000, container);
camera1.speed = 0.001; camera1.speed = 0.001;
camera1.reset(); camera1.reset();
camera1.save();
scene.add(camera1); scene.add(camera1);
cameras.push(camera1); cameras.push(camera1);