Corrected bugs in tutorial

This commit is contained in:
Thomas FORGIONE 2015-06-25 14:59:22 +02:00
parent 5c42c6c63d
commit d00bea6229
2 changed files with 14 additions and 2 deletions

View File

@ -206,9 +206,11 @@ TutoCamera.prototype.normalMotion = function(time) {
if (this.motion.decreaseTheta) {this.theta -= this.sensitivity; this.changed = true; } if (this.motion.decreaseTheta) {this.theta -= this.sensitivity; this.changed = true; }
if (this.isLocked() || this.dragging) { if (this.isLocked() || this.dragging) {
this.theta += this.mouseMove.x; this.theta += this.mouseMove.x;
this.phi -= this.mouseMove.y; this.phi -= this.mouseMove.y;
this.mouseMove.x = 0; this.mouseMove.x = 0;
this.mouseMove.y = 0; this.mouseMove.y = 0;
@ -271,6 +273,9 @@ TutoCamera.prototype.reset = function() {
this.moving = false; this.moving = false;
this.movingHermite = false; this.movingHermite = false;
(new BD.Event.ResetClicked()).send(); (new BD.Event.ResetClicked()).send();
this.previousTheta = this.theta;
this.previousPhi = this.phi;
} }
TutoCamera.prototype.resetPosition = function() { TutoCamera.prototype.resetPosition = function() {
@ -454,6 +459,9 @@ TutoCamera.prototype.onMouseDown = function(event) {
TutoCamera.prototype.onMouseMove = function(event) { TutoCamera.prototype.onMouseMove = function(event) {
if (!this.shouldLock && this.dragging) { if (!this.shouldLock && this.dragging) {
this.previousTheta = this.theta;
this.previousPhi = this.phi;
var mouse = {x: this.mouse.x, y: this.mouse.y}; var mouse = {x: this.mouse.x, y: this.mouse.y};
this.mouse.x = ( ( event.clientX - this.renderer.domElement.offsetLeft ) / this.renderer.domElement.width ) * 2 - 1; this.mouse.x = ( ( event.clientX - this.renderer.domElement.offsetLeft ) / this.renderer.domElement.width ) * 2 - 1;
this.mouse.y = - ( ( event.clientY - this.renderer.domElement.offsetTop ) / this.renderer.domElement.height ) * 2 + 1; this.mouse.y = - ( ( event.clientY - this.renderer.domElement.offsetTop ) / this.renderer.domElement.height ) * 2 + 1;
@ -479,8 +487,8 @@ TutoCamera.prototype.onMouseMovePointer = function(e) {
this.mouseMove.x = e.movementX || e.mozMovementX || e.webkitMovementX || 0; this.mouseMove.x = e.movementX || e.mozMovementX || e.webkitMovementX || 0;
this.mouseMove.y = e.movementY || e.mozMovementY || e.webkitMovementY || 0; this.mouseMove.y = e.movementY || e.mozMovementY || e.webkitMovementY || 0;
this.mouseMove.x *= -(this.sensitivity/5); this.mouseMove.x *= -(this.sensitivity/10);
this.mouseMove.y *= (this.sensitivity/5); this.mouseMove.y *= (this.sensitivity/10);
this.mouseMoved = true; this.mouseMoved = true;

View File

@ -95,6 +95,8 @@ var TutorialSteps = function(tutoCamera, scene, coins, onWindowResize, container
nextStep = function() {self.nextStep();}; nextStep = function() {self.nextStep();};
this.scene = scene; this.scene = scene;
Coin.domElement.style.display = "none";
} }
TutorialSteps.prototype.setCameras = function(cameras) { TutorialSteps.prototype.setCameras = function(cameras) {
@ -102,6 +104,7 @@ TutorialSteps.prototype.setCameras = function(cameras) {
} }
TutorialSteps.prototype.nextStep = function() { TutorialSteps.prototype.nextStep = function() {
console.log(this.step);
if (this.step < this.instructions.length) { if (this.step < this.instructions.length) {
this.alert(this.instructions[this.step].text, this.instructions[this.step].justclick); this.alert(this.instructions[this.step].text, this.instructions[this.step].justclick);
var callback = function() {self.coinNumber++; self.nextStep();}; var callback = function() {self.coinNumber++; self.nextStep();};
@ -111,6 +114,7 @@ TutorialSteps.prototype.nextStep = function() {
case 3: this.camera.allowed.mouseRotate = true; break; case 3: this.camera.allowed.mouseRotate = true; break;
case 4: this.camera.allowed.keyboardRotate = true; break; case 4: this.camera.allowed.keyboardRotate = true; break;
case 5: case 5:
Coin.domElement.style.display = "";
Coin.max = 1; Coin.max = 1;
Coin.update(); Coin.update();
this.camera.allowed.keyboardRotate = true; this.camera.allowed.keyboardRotate = true;