Browse Source

Fix Quaternion accessors

Tristan VALCKE 8 years ago
parent
commit
6c513a0660
1 changed files with 47 additions and 27 deletions
  1. 47 27
      src/math/Quaternion.js

+ 47 - 27
src/math/Quaternion.js

@@ -89,61 +89,81 @@ Object.assign( Quaternion, {
 
 } );
 
-Object.assign( Quaternion.prototype, {
+Object.defineProperties( Quaternion.prototype, {
 
-	constructor: Quaternion,
+	"x" : {
 
-	get x () {
+		get: function () {
 
-		return this._x;
+			return this._x;
 
-	},
+		},
 
-	set x ( value ) {
+		set: function ( value ) {
 
-		this._x = value;
-		this.onChangeCallback();
+			this._x = value;
+			this.onChangeCallback();
+
+		}
 
 	},
 
-	get y () {
+	"y" : {
 
-		return this._y;
+		get: function () {
 
-	},
+			return this._y;
 
-	set y ( value ) {
+		},
 
-		this._y = value;
-		this.onChangeCallback();
+		set: function ( value ) {
+
+			this._y = value;
+			this.onChangeCallback();
+
+		}
 
 	},
 
-	get z () {
+	"z" : {
 
-		return this._z;
+		get: function () {
 
-	},
+			return this._z;
 
-	set z ( value ) {
+		},
 
-		this._z = value;
-		this.onChangeCallback();
+		set: function ( value ) {
+
+			this._z = value;
+			this.onChangeCallback();
+
+		}
 
 	},
 
-	get w () {
+	"w" : {
 
-		return this._w;
+		get: function () {
 
-	},
+			return this._w;
 
-	set w ( value ) {
+		},
 
-		this._w = value;
-		this.onChangeCallback();
+		set: function ( value ) {
 
-	},
+			this._w = value;
+			this.onChangeCallback();
+
+		}
+
+	}
+
+});
+
+Object.assign( Quaternion.prototype, {
+
+	constructor: Quaternion,
 
 	set: function ( x, y, z, w ) {