In js, we don't know how to test if something is undefined

This commit is contained in:
Thomas FORGIONE
2015-04-07 11:56:14 +02:00
parent ae620e2cfc
commit 7c138c3c27
4 changed files with 9 additions and 9 deletions

View File

@@ -197,7 +197,7 @@ function click(event) {
// Looking for cameras
for (i in intersects) {
if (minDistance === undefined || intersects[i].distance < minDistance) {
if (typeof 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 (bestIndex !== undefined) {
if (typeof bestIndex !== 'undefined') {
cameras.setById(intersects[bestIndex].object.id);
}