Browse Source

Fix Vector2 accessors

Tristan VALCKE 8 years ago
parent
commit
13f13397e9
1 changed files with 12 additions and 23 deletions
  1. 12 23
      src/math/Vector2.js

+ 12 - 23
src/math/Vector2.js

@@ -12,37 +12,26 @@ function Vector2( x, y ) {
 
 }
 
-Object.assign( Vector2.prototype, {
-
-	constructor: Vector2,
-
-	isVector2: true,
-
-	get width() {
-
-		return this.x;
+Object.defineProperties( Vector2.prototype, {
 
+	"width" : {
+		get: function () { return this.x; },
+		set: function ( value ) { this.x = value; }
 	},
 
-	set width( value ) {
-
-		this.x = value;
-
-	},
-
-	get height() {
-
-		return this.y;
+	"height" : {
+		get: function () { return this.y; },
+		set: function ( value ) { this.y = value; }
+	}
 
-	},
+} );
 
-	set height( value ) {
 
-		this.y = value;
+Object.assign( Vector2.prototype, {
 
-	},
+	constructor: Vector2,
 
-	//
+	isVector2: true,
 
 	set: function ( x, y ) {