浏览代码

Return 'this' in Vector2/3::ScaleInPlace/Normalize for easy chaining

Yannick 11 年之前
父节点
当前提交
086b95c77d
共有 2 个文件被更改,包括 12 次插入0 次删除
  1. 6 0
      Babylon/Math/babylon.math.js
  2. 6 0
      Babylon/Math/babylon.math.ts

+ 6 - 0
Babylon/Math/babylon.math.js

@@ -327,6 +327,7 @@
         Vector2.prototype.scaleInPlace = function (scale) {
             this.x *= scale;
             this.y *= scale;
+            return this;
         };
 
         Vector2.prototype.scale = function (scale) {
@@ -357,6 +358,8 @@
 
             this.x *= num;
             this.y *= num;
+
+            return this;
         };
 
         Vector2.prototype.clone = function () {
@@ -549,6 +552,7 @@
             this.x *= scale;
             this.y *= scale;
             this.z *= scale;
+            return this;
         };
 
         Vector3.prototype.scale = function (scale) {
@@ -642,6 +646,8 @@
             this.x *= num;
             this.y *= num;
             this.z *= num;
+
+            return this;
         };
 
         Vector3.prototype.clone = function () {

+ 6 - 0
Babylon/Math/babylon.math.ts

@@ -293,6 +293,7 @@
         public scaleInPlace(scale: number): void {
             this.x *= scale;
             this.y *= scale;
+            return this;
         }
 
         public scale(scale: number): Vector2 {
@@ -323,6 +324,8 @@
 
             this.x *= num;
             this.y *= num;
+
+            return this;
         }
 
         public clone(): Vector2 {
@@ -516,6 +519,7 @@
             this.x *= scale;
             this.y *= scale;
             this.z *= scale;
+            return this;
         }
 
         public scale(scale: number): Vector3 {
@@ -605,6 +609,8 @@
             this.x *= num;
             this.y *= num;
             this.z *= num;
+
+            return this;
         }
 
         public clone(): Vector3 {