From 96db6d177f9d7b80b13bfd8fc6c8ea2d28d8be29 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Tue, 7 Apr 2015 12:04:59 +0200 Subject: [PATCH] Revert "In js, we don't know how to test if something is undefined" This reverts commit 7c138c3c276b0ecc2e7905590ff8b04770ea2b78. --- js/CameraContainer.js | 4 ++-- js/Cube.js | 6 +++--- js/FixedCamera.js | 4 ++-- scene/js/main.js | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/js/CameraContainer.js b/js/CameraContainer.js index b59cc8a..5bb1600 100644 --- a/js/CameraContainer.js +++ b/js/CameraContainer.js @@ -4,7 +4,7 @@ var CameraContainer = function () { } CameraContainer.prototype.mainCamera = function(id) { - if (typeof id === 'undefined') { + if (id === undefined) { return this.cameras[this.current_camera]; } if (id >= cameras.length || id < 0) { @@ -37,7 +37,7 @@ CameraContainer.prototype.get = function(i) { CameraContainer.prototype.getById = function(id) { for (var i in this.cameras) { - if (typeof this.cameras[i].mesh !== 'undefined') { + if (this.cameras[i].mesh !== undefined) { if (this.cameras[i].mesh.id == id) { return i; } diff --git a/js/Cube.js b/js/Cube.js index 4210ea4..1f2a07f 100644 --- a/js/Cube.js +++ b/js/Cube.js @@ -15,8 +15,8 @@ var Cube = function(size, style) { // Super constructor call Displayable.call(this); - if (typeof size === 'undefined') size = 100; - if (typeof style === 'undefined') style = {}; + if (size === undefined) size = 100; + if (style === undefined) style = {}; this.geometry = new THREE.BoxGeometry(size, size, size); // this.geometry.computeVertexNormals(); @@ -33,7 +33,7 @@ Cube.prototype.constructor = Cube; var Plane = function(size1, size2, style) { Displayable.call(this); - if (typeof style === 'undefined') style = {}; + if (style === undefined) style = {}; this.geometry = new THREE.PlaneBufferGeometry(size1, size2); this.material = new THREE.MeshLambertMaterial(style); diff --git a/js/FixedCamera.js b/js/FixedCamera.js index 10710c5..88c21d1 100644 --- a/js/FixedCamera.js +++ b/js/FixedCamera.js @@ -5,7 +5,7 @@ var FixedCamera = function(arg1, arg2, arg3, arg4, position, target) { THREE.PerspectiveCamera.apply(this, arguments); // Set Position - if (typeof position === 'undefined') { + if (position === undefined) { this.position = new THREE.Vector3(0,0,5); } else { this.position.x = position.x; @@ -14,7 +14,7 @@ var FixedCamera = function(arg1, arg2, arg3, arg4, position, target) { } - if (typeof target === 'undefined') + if (target === undefined) target = new THREE.Vector3(0,0,0); var direction = target.clone(); diff --git a/scene/js/main.js b/scene/js/main.js index b5d4be8..e0bace3 100644 --- a/scene/js/main.js +++ b/scene/js/main.js @@ -197,7 +197,7 @@ function click(event) { // Looking for cameras for (i in intersects) { - if (typeof minDistance === 'undefined' || intersects[i].distance < minDistance) { + if (minDistance === undefined || intersects[i].distance < minDistance) { // We will not consider a line as clickable if (! (intersects[i].object instanceof THREE.Line)) { minDistance = intersects[i].distance; @@ -205,7 +205,7 @@ function click(event) { } } } - if (typeof bestIndex !== 'undefined') { + if (bestIndex !== undefined) { cameras.setById(intersects[bestIndex].object.id); }