From 3c11aba19479d61fe508af5723a3696b4f53dd97 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Fri, 3 Jul 2015 09:58:44 +0200 Subject: [PATCH] corrected double log of arrow clicked --- js/l3d/src/cameras/PointerCamera.js | 9 +++++--- js/l3d/src/utils/CameraSelecter.js | 33 +++++++++++++++++------------ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/js/l3d/src/cameras/PointerCamera.js b/js/l3d/src/cameras/PointerCamera.js index 8de6bc0..cdfe79e 100644 --- a/js/l3d/src/cameras/PointerCamera.js +++ b/js/l3d/src/cameras/PointerCamera.js @@ -262,10 +262,13 @@ L3D.PointerCamera.prototype.onPointerLockChange = function() { L3D.PointerCamera.prototype.update = function(time) { if (this.moving) { this.linearMotion(time); - } else if (this.movingHermite) { - this.hermiteMotion(time); } else { - this.normalMotion(time); + this.shouldLogCameraAngles = false; + if (this.movingHermite) { + this.hermiteMotion(time); + } else { + this.normalMotion(time); + } } }; diff --git a/js/l3d/src/utils/CameraSelecter.js b/js/l3d/src/utils/CameraSelecter.js index 3c9ebb1..d2f05ad 100644 --- a/js/l3d/src/utils/CameraSelecter.js +++ b/js/l3d/src/utils/CameraSelecter.js @@ -115,25 +115,30 @@ L3D.CameraSelecter.prototype.update = function(event, y) { L3D.CameraSelecter.prototype.click = function(event) { var e; - var newCamera = this.pointedCamera(); - if (newCamera !== undefined && !(newCamera instanceof Coin)) { + if (this.cameras.mainCamera().pointerLocked === false) { - e = new L3D.BD.Event.ArrowClicked(); - e.arrow_id = this.cameras.cameras.indexOf(newCamera); - e.send(); + var newCamera = this.pointedCamera(); - newCamera.check(); - this.cameras.mainCamera().moveHermite(newCamera); - buttonManager.updateElements(); + if (newCamera !== undefined && !(newCamera instanceof Coin)) { - } else if (newCamera instanceof Coin) { + e = new L3D.BD.Event.ArrowClicked(); + e.arrow_id = this.cameras.cameras.indexOf(newCamera); + e.send(); - // Coin found, notify server - e = new L3D.BD.Event.CoinClicked(); - e.coin_id = this.coins.indexOf(newCamera); - e.send(); - newCamera.get(); + newCamera.check(); + this.cameras.mainCamera().moveHermite(newCamera); + buttonManager.updateElements(); + + } else if (newCamera instanceof Coin) { + + // Coin found, notify server + e = new L3D.BD.Event.CoinClicked(); + e.coin_id = this.coins.indexOf(newCamera); + e.send(); + newCamera.get(); + + } }