Bug corrected
This commit is contained in:
parent
a9044f4cd5
commit
7993c02109
|
@ -293,94 +293,44 @@ TutoCamera.prototype.onKeyEvent = function(event, toSet) {
|
||||||
var motionJsonCopy = JSON.stringify(this.motion);
|
var motionJsonCopy = JSON.stringify(this.motion);
|
||||||
|
|
||||||
if (this.allowed.keyboardTranslate) {
|
if (this.allowed.keyboardTranslate) {
|
||||||
|
var moved = true;
|
||||||
|
|
||||||
switch ( event.keyCode ) {
|
switch ( event.keyCode ) {
|
||||||
// yes... lots of duplication near there
|
|
||||||
// if fact, I gave up trying to have a tutorial well coded...
|
|
||||||
|
|
||||||
// Azerty keyboards
|
// Azerty keyboards
|
||||||
case 38: case 90: // up / z
|
case 38: case 90: this.motion.moveForward = toSet; break; // up / z
|
||||||
this.motion.moveForward = toSet;
|
case 37: case 81: this.motion.moveLeft = toSet; break; // left / q
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
case 40: case 83: this.motion.moveBackward = toSet; break; // down / s
|
||||||
this.tutorial.nextStep();
|
case 39: case 68: this.motion.moveRight = toSet; break; // right / d
|
||||||
break;
|
|
||||||
|
|
||||||
case 37: case 81: // left / q
|
|
||||||
this.motion.moveLeft = toSet;
|
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 40: case 83: // down / s
|
|
||||||
this.motion.moveBackward = toSet;
|
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 39: case 68: // right / d
|
|
||||||
this.motion.moveRight = toSet;
|
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 32:
|
|
||||||
this.motion.boost = toSet;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Qwerty keyboards
|
// Qwerty keyboards
|
||||||
case 38: case 87: // up / w
|
case 38: case 87: this.motion.moveForward = toSet; break; // up / w
|
||||||
this.motion.moveForward = toSet;
|
case 37: case 65: this.motion.moveLeft = toSet; break; // left / a
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
case 40: case 83: this.motion.moveBackward = toSet; break; // down / s
|
||||||
this.tutorial.nextStep();
|
case 39: case 68: this.motion.moveRight = toSet; break; // right / d
|
||||||
break; // up / w
|
|
||||||
|
|
||||||
case 37: case 65: // left / a
|
case 32: this.motion.boost = toSet; moved = false; break;
|
||||||
this.motion.moveLeft = toSet;
|
default: moved = false; break;
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
}
|
||||||
this.tutorial.nextStep();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 40: case 83: // down / s
|
if (moved && this.tutorial.nextAction() === 'translate-keyboard' && !toSet) {
|
||||||
this.motion.moveBackward = toSet;
|
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
this.tutorial.nextStep();
|
||||||
break;
|
|
||||||
|
|
||||||
case 39: case 68: // right / d
|
|
||||||
this.motion.moveRight = toSet;
|
|
||||||
if (this.tutorial.nextAction() === 'translate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.allowed.keyboardRotate) {
|
if (this.allowed.keyboardRotate) {
|
||||||
|
var moved = true;
|
||||||
|
|
||||||
switch ( event.keyCode ) {
|
switch ( event.keyCode ) {
|
||||||
case 73: case 104: // 8 / i Up for angle
|
case 73: case 104: this.motion.increasePhi = toSet; break; // 8 Up for angle
|
||||||
this.motion.increasePhi = toSet;
|
case 75: case 98: this.motion.decreasePhi = toSet; break; // 2 Down for angle
|
||||||
if (this.tutorial.nextAction() === 'rotate-keyboard')
|
case 74: case 100: this.motion.increaseTheta = toSet; break; // 4 Left for angle
|
||||||
this.tutorial.nextStep();
|
case 76: case 102: this.motion.decreaseTheta = toSet; break; // 6 Right for angle
|
||||||
break;
|
|
||||||
|
|
||||||
case 75: case 98: // 2 / k Down for angle
|
default: moved = false; break;
|
||||||
this.motion.decreasePhi = toSet;
|
}
|
||||||
if (this.tutorial.nextAction() === 'rotate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 74: case 100: // 4 / j Left for angle
|
if (moved && this.tutorial.nextAction() === 'rotate-keyboard' && !toSet) {
|
||||||
this.motion.increaseTheta = toSet;
|
|
||||||
if (this.tutorial.nextAction() === 'rotate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
this.tutorial.nextStep();
|
||||||
break;
|
|
||||||
|
|
||||||
case 76: case 102: // 6 / l Right for angle
|
|
||||||
this.motion.decreaseTheta = toSet;
|
|
||||||
if (this.tutorial.nextAction() === 'rotate-keyboard')
|
|
||||||
this.tutorial.nextStep();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,12 @@ Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||||
this.renderer.render(this.scene, prev.camera);
|
this.renderer.render(this.scene, prev.camera);
|
||||||
|
|
||||||
this.update(true);
|
this.update(true);
|
||||||
|
|
||||||
|
if (this.prevCamera !== prev.camera) {
|
||||||
|
this.clearNeeded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.prevCamera = prev.camera;
|
||||||
} else {
|
} else {
|
||||||
this.update(false);
|
this.update(false);
|
||||||
}
|
}
|
||||||
|
@ -70,12 +76,14 @@ Previewer.prototype.render = function(prev, container_width, container_height) {
|
||||||
if (this.drawnBefore && !this.drawn) {
|
if (this.drawnBefore && !this.drawn) {
|
||||||
this.clearNeeded = true;
|
this.clearNeeded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Previewer.prototype.clear = function() {
|
Previewer.prototype.clear = function() {
|
||||||
if (this.clearNeeded) {
|
if (this.clearNeeded) {
|
||||||
this.domElement.width = this.domElement.width;
|
this.domElement.width = this.domElement.width;
|
||||||
this.clearNeeded = false;
|
this.clearNeeded = false;
|
||||||
|
console.log("Clear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue