Răsfoiți Sursa

remove lazy-conditions.

Ben Houston 12 ani în urmă
părinte
comite
a963e2dc38
3 a modificat fișierele cu 6 adăugiri și 6 ștergeri
  1. 2 2
      src/math/Vector2.js
  2. 2 2
      src/math/Vector3.js
  3. 2 2
      src/math/Vector4.js

+ 2 - 2
src/math/Vector2.js

@@ -118,7 +118,7 @@ THREE.Vector2.prototype = {
 
 	divideScalar: function ( s ) {
 
-		if ( s ) {
+		if ( s !== 0 ) {
 
 			this.x /= s;
 			this.y /= s;
@@ -244,7 +244,7 @@ THREE.Vector2.prototype = {
 
 		var oldLength = this.length();
 		
-		if( oldLength ) {
+		if ( oldLength !== 0 && l !== oldLength  ) {
 
 			this.multiplyScalar( l / oldLength );
 		}

+ 2 - 2
src/math/Vector3.js

@@ -168,7 +168,7 @@ THREE.Vector3.prototype = {
 
 	divideScalar: function ( s ) {
 
-		if ( s ) {
+		if ( s !== 0 ) {
 
 			this.x /= s;
 			this.y /= s;
@@ -312,7 +312,7 @@ THREE.Vector3.prototype = {
 
 		var oldLength = this.length();
 		
-		if( oldLength ) {
+		if ( oldLength !== 0 && l !== oldLength  ) {
 
 			this.multiplyScalar( l / oldLength );
 		}

+ 2 - 2
src/math/Vector4.js

@@ -153,7 +153,7 @@ THREE.Vector4.prototype = {
 
 	divideScalar: function ( s ) {
 
-		if ( s ) {
+		if ( s !== 0 ) {
 
 			this.x /= s;
 			this.y /= s;
@@ -321,7 +321,7 @@ THREE.Vector4.prototype = {
 
 		var oldLength = this.length();
 		
-		if( oldLength ) {
+		if ( oldLength !== 0 && l !== oldLength  ) {
 
 			this.multiplyScalar( l / oldLength );
 		}