From d00bea62293b2255036113aa23604c76c094b30d Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Thu, 25 Jun 2015 14:59:22 +0200 Subject: [PATCH] Corrected bugs in tutorial --- js/TutoCamera.js | 12 ++++++++++-- js/prototype/TutorialSteps.js | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/js/TutoCamera.js b/js/TutoCamera.js index 3477dc8..8eb4db2 100644 --- a/js/TutoCamera.js +++ b/js/TutoCamera.js @@ -206,9 +206,11 @@ TutoCamera.prototype.normalMotion = function(time) { if (this.motion.decreaseTheta) {this.theta -= this.sensitivity; this.changed = true; } if (this.isLocked() || this.dragging) { + this.theta += this.mouseMove.x; this.phi -= this.mouseMove.y; + this.mouseMove.x = 0; this.mouseMove.y = 0; @@ -271,6 +273,9 @@ TutoCamera.prototype.reset = function() { this.moving = false; this.movingHermite = false; (new BD.Event.ResetClicked()).send(); + + this.previousTheta = this.theta; + this.previousPhi = this.phi; } TutoCamera.prototype.resetPosition = function() { @@ -454,6 +459,9 @@ TutoCamera.prototype.onMouseDown = function(event) { TutoCamera.prototype.onMouseMove = function(event) { if (!this.shouldLock && this.dragging) { + this.previousTheta = this.theta; + this.previousPhi = this.phi; + 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.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.y = e.movementY || e.mozMovementY || e.webkitMovementY || 0; - this.mouseMove.x *= -(this.sensitivity/5); - this.mouseMove.y *= (this.sensitivity/5); + this.mouseMove.x *= -(this.sensitivity/10); + this.mouseMove.y *= (this.sensitivity/10); this.mouseMoved = true; diff --git a/js/prototype/TutorialSteps.js b/js/prototype/TutorialSteps.js index a0372ae..72ead2d 100644 --- a/js/prototype/TutorialSteps.js +++ b/js/prototype/TutorialSteps.js @@ -95,6 +95,8 @@ var TutorialSteps = function(tutoCamera, scene, coins, onWindowResize, container nextStep = function() {self.nextStep();}; this.scene = scene; + + Coin.domElement.style.display = "none"; } TutorialSteps.prototype.setCameras = function(cameras) { @@ -102,6 +104,7 @@ TutorialSteps.prototype.setCameras = function(cameras) { } TutorialSteps.prototype.nextStep = function() { + console.log(this.step); if (this.step < this.instructions.length) { this.alert(this.instructions[this.step].text, this.instructions[this.step].justclick); var callback = function() {self.coinNumber++; self.nextStep();}; @@ -111,6 +114,7 @@ TutorialSteps.prototype.nextStep = function() { case 3: this.camera.allowed.mouseRotate = true; break; case 4: this.camera.allowed.keyboardRotate = true; break; case 5: + Coin.domElement.style.display = ""; Coin.max = 1; Coin.update(); this.camera.allowed.keyboardRotate = true;