Преглед изворни кода

Core: make Vector and Matrix .is* property non-enumerable (#24219)

Marco Fugaro пре 3 година
родитељ
комит
c14b7189ce

+ 1 - 1
src/math/Matrix3.js

@@ -2,7 +2,7 @@ class Matrix3 {
 
 	constructor() {
 
-		this.isMatrix3 = true;
+		Matrix3.prototype.isMatrix3 = true;
 
 		this.elements = [
 

+ 1 - 1
src/math/Matrix4.js

@@ -4,7 +4,7 @@ class Matrix4 {
 
 	constructor() {
 
-		this.isMatrix4 = true;
+		Matrix4.prototype.isMatrix4 = true;
 
 		this.elements = [
 

+ 1 - 1
src/math/Vector2.js

@@ -2,7 +2,7 @@ class Vector2 {
 
 	constructor( x = 0, y = 0 ) {
 
-		this.isVector2 = true;
+		Vector2.prototype.isVector2 = true;
 
 		this.x = x;
 		this.y = y;

+ 1 - 1
src/math/Vector3.js

@@ -5,7 +5,7 @@ class Vector3 {
 
 	constructor( x = 0, y = 0, z = 0 ) {
 
-		this.isVector3 = true;
+		Vector3.prototype.isVector3 = true;
 
 		this.x = x;
 		this.y = y;

+ 1 - 1
src/math/Vector4.js

@@ -2,7 +2,7 @@ class Vector4 {
 
 	constructor( x = 0, y = 0, z = 0, w = 1 ) {
 
-		this.isVector4 = true;
+		Vector4.prototype.isVector4 = true;
 
 		this.x = x;
 		this.y = y;

+ 5 - 3
test/unit/src/core/Object3D.tests.js

@@ -301,9 +301,11 @@ export default QUnit.module( 'Core', () => {
 			obj.translateOnAxis( new Vector3( 0, 1, 0 ), 1.23 );
 			obj.translateOnAxis( new Vector3( 0, 0, 1 ), - 4.56 );
 
-			assert.numEqual( obj.position.x, 1, 'x is equal' );
-			assert.numEqual( obj.position.y, 1.23, 'y is equal' );
-			assert.numEqual( obj.position.z, - 4.56, 'z is equal' );
+			assert.propEqual( obj.position, {
+				x: 1,
+				y: 1.23,
+				z: - 4.56,
+			} );
 
 		} );