Skip to content

Commit

Permalink
Core: make Vector and Matrix .is* property non-enumerable (#24219)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcofugaro authored Jun 13, 2022
1 parent 164e7fe commit c14b718
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/math/Matrix3.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Matrix3 {

constructor() {

this.isMatrix3 = true;
Matrix3.prototype.isMatrix3 = true;

this.elements = [

Expand Down
2 changes: 1 addition & 1 deletion src/math/Matrix4.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Matrix4 {

constructor() {

this.isMatrix4 = true;
Matrix4.prototype.isMatrix4 = true;

this.elements = [

Expand Down
2 changes: 1 addition & 1 deletion src/math/Vector2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Vector2 {

constructor( x = 0, y = 0 ) {

this.isVector2 = true;
Vector2.prototype.isVector2 = true;

this.x = x;
this.y = y;
Expand Down
2 changes: 1 addition & 1 deletion src/math/Vector3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/math/Vector4.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 5 additions & 3 deletions test/unit/src/core/Object3D.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
} );

} );

Expand Down

0 comments on commit c14b718

Please sign in to comment.