diff --git a/src/pixi/geom/Circle.js b/src/pixi/geom/Circle.js index cc39a28..541e0fe 100644 --- a/src/pixi/geom/Circle.js +++ b/src/pixi/geom/Circle.js @@ -39,7 +39,7 @@ * Creates a clone of this Circle instance * * @method clone - * @return {Circle} a copy of the polygon + * @return {Circle} a copy of the Circle */ PIXI.Circle.prototype.clone = function() { @@ -47,12 +47,12 @@ }; /** - * Checks whether the x, and y coordinates passed to this function are contained within this circle + * Checks whether the x and y coordinates given are contained within this circle * * @method contains * @param x {Number} The X coordinate of the point to test * @param y {Number} The Y coordinate of the point to test - * @return {Boolean} Whether the x/y coordinates are within this polygon + * @return {Boolean} Whether the x/y coordinates are within this Circle */ PIXI.Circle.prototype.contains = function(x, y) { @@ -82,4 +82,3 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - diff --git a/src/pixi/geom/Circle.js b/src/pixi/geom/Circle.js index cc39a28..541e0fe 100644 --- a/src/pixi/geom/Circle.js +++ b/src/pixi/geom/Circle.js @@ -39,7 +39,7 @@ * Creates a clone of this Circle instance * * @method clone - * @return {Circle} a copy of the polygon + * @return {Circle} a copy of the Circle */ PIXI.Circle.prototype.clone = function() { @@ -47,12 +47,12 @@ }; /** - * Checks whether the x, and y coordinates passed to this function are contained within this circle + * Checks whether the x and y coordinates given are contained within this circle * * @method contains * @param x {Number} The X coordinate of the point to test * @param y {Number} The Y coordinate of the point to test - * @return {Boolean} Whether the x/y coordinates are within this polygon + * @return {Boolean} Whether the x/y coordinates are within this Circle */ PIXI.Circle.prototype.contains = function(x, y) { @@ -82,4 +82,3 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - diff --git a/src/pixi/geom/Ellipse.js b/src/pixi/geom/Ellipse.js index b376333..0dd71f3 100644 --- a/src/pixi/geom/Ellipse.js +++ b/src/pixi/geom/Ellipse.js @@ -55,7 +55,7 @@ }; /** - * Checks whether the x and y coordinates passed to this function are contained within this ellipse + * Checks whether the x and y coordinates given are contained within this ellipse * * @method contains * @param x {Number} The X coordinate of the point to test diff --git a/src/pixi/geom/Circle.js b/src/pixi/geom/Circle.js index cc39a28..541e0fe 100644 --- a/src/pixi/geom/Circle.js +++ b/src/pixi/geom/Circle.js @@ -39,7 +39,7 @@ * Creates a clone of this Circle instance * * @method clone - * @return {Circle} a copy of the polygon + * @return {Circle} a copy of the Circle */ PIXI.Circle.prototype.clone = function() { @@ -47,12 +47,12 @@ }; /** - * Checks whether the x, and y coordinates passed to this function are contained within this circle + * Checks whether the x and y coordinates given are contained within this circle * * @method contains * @param x {Number} The X coordinate of the point to test * @param y {Number} The Y coordinate of the point to test - * @return {Boolean} Whether the x/y coordinates are within this polygon + * @return {Boolean} Whether the x/y coordinates are within this Circle */ PIXI.Circle.prototype.contains = function(x, y) { @@ -82,4 +82,3 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - diff --git a/src/pixi/geom/Ellipse.js b/src/pixi/geom/Ellipse.js index b376333..0dd71f3 100644 --- a/src/pixi/geom/Ellipse.js +++ b/src/pixi/geom/Ellipse.js @@ -55,7 +55,7 @@ }; /** - * Checks whether the x and y coordinates passed to this function are contained within this ellipse + * Checks whether the x and y coordinates given are contained within this ellipse * * @method contains * @param x {Number} The X coordinate of the point to test diff --git a/src/pixi/geom/Matrix.js b/src/pixi/geom/Matrix.js index 5e73cdd..e12d0e8 100644 --- a/src/pixi/geom/Matrix.js +++ b/src/pixi/geom/Matrix.js @@ -14,19 +14,61 @@ */ PIXI.Matrix = function() { + /** + * @property a + * @type Number + * @default 1 + */ this.a = 1; + + /** + * @property b + * @type Number + * @default 0 + */ this.b = 0; + + /** + * @property c + * @type Number + * @default 0 + */ this.c = 0; + + /** + * @property d + * @type Number + * @default 1 + */ this.d = 1; + + /** + * @property tx + * @type Number + * @default 0 + */ this.tx = 0; + + /** + * @property ty + * @type Number + * @default 0 + */ this.ty = 0; }; /** - * Creates a pixi matrix object based on the array given as a parameter + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] * * @method fromArray - * @param array {Array} The array that the matrix will be filled with + * @param array {Array} The array that the matrix will be populated from. */ PIXI.Matrix.prototype.fromArray = function(array) { @@ -39,7 +81,7 @@ }; /** - * Creates an array from the current Matrix object + * Creates an array from the current Matrix object. * * @method toArray * @param transpose {Boolean} Whether we need to transpose the matrix or not @@ -79,13 +121,13 @@ }; /** - * Get a new position with the current transormation applied. + * Get a new position with the current transformation applied. * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) * * @method apply * @param pos {Point} The origin * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input) - * @return {Point} The new point, transformed trough this matrix + * @return {Point} The new point, transformed through this matrix */ PIXI.Matrix.prototype.apply = function(pos, newPos) { @@ -98,13 +140,13 @@ }; /** - * Get a new position with the inverse of the current transormation applied. + * Get a new position with the inverse of the current transformation applied. * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) * - * @method apply + * @method applyInverse * @param pos {Point} The origin * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input) - * @return {Point} The new point, inverse-transformed trough this matrix + * @return {Point} The new point, inverse-transformed through this matrix */ PIXI.Matrix.prototype.applyInverse = function(pos, newPos) { @@ -119,6 +161,7 @@ /** * Translates the matrix on the x and y. + * * @method translate * @param {Number} x * @param {Number} y @@ -134,6 +177,7 @@ /** * Applies a scale transformation to the matrix. + * * @method scale * @param {Number} x The amount to scale horizontally * @param {Number} y The amount to scale vertically @@ -177,14 +221,13 @@ return this; }; - /** - * Translates the matrix on the x and y. - * @method translate - * @param {Number} x - * @param {Number} y + * Appends the given Matrix to this Matrix. + * + * @method append + * @param {Matrix} matrix * @return {Matrix} This matrix. Good for chaining method calls. - **/ + */ PIXI.Matrix.prototype.append = function(matrix) { var a1 = this.a; @@ -203,6 +246,12 @@ return this; }; +/** + * Resets this Matix to an identity (default) matrix. + * + * @method identity + * @return {Matrix} This matrix. Good for chaining method calls. + */ PIXI.Matrix.prototype.identity = function() { this.a = 1; @@ -211,6 +260,8 @@ this.d = 1; this.tx = 0; this.ty = 0; + + return this; }; PIXI.identityMatrix = new PIXI.Matrix(); diff --git a/src/pixi/geom/Circle.js b/src/pixi/geom/Circle.js index cc39a28..541e0fe 100644 --- a/src/pixi/geom/Circle.js +++ b/src/pixi/geom/Circle.js @@ -39,7 +39,7 @@ * Creates a clone of this Circle instance * * @method clone - * @return {Circle} a copy of the polygon + * @return {Circle} a copy of the Circle */ PIXI.Circle.prototype.clone = function() { @@ -47,12 +47,12 @@ }; /** - * Checks whether the x, and y coordinates passed to this function are contained within this circle + * Checks whether the x and y coordinates given are contained within this circle * * @method contains * @param x {Number} The X coordinate of the point to test * @param y {Number} The Y coordinate of the point to test - * @return {Boolean} Whether the x/y coordinates are within this polygon + * @return {Boolean} Whether the x/y coordinates are within this Circle */ PIXI.Circle.prototype.contains = function(x, y) { @@ -82,4 +82,3 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - diff --git a/src/pixi/geom/Ellipse.js b/src/pixi/geom/Ellipse.js index b376333..0dd71f3 100644 --- a/src/pixi/geom/Ellipse.js +++ b/src/pixi/geom/Ellipse.js @@ -55,7 +55,7 @@ }; /** - * Checks whether the x and y coordinates passed to this function are contained within this ellipse + * Checks whether the x and y coordinates given are contained within this ellipse * * @method contains * @param x {Number} The X coordinate of the point to test diff --git a/src/pixi/geom/Matrix.js b/src/pixi/geom/Matrix.js index 5e73cdd..e12d0e8 100644 --- a/src/pixi/geom/Matrix.js +++ b/src/pixi/geom/Matrix.js @@ -14,19 +14,61 @@ */ PIXI.Matrix = function() { + /** + * @property a + * @type Number + * @default 1 + */ this.a = 1; + + /** + * @property b + * @type Number + * @default 0 + */ this.b = 0; + + /** + * @property c + * @type Number + * @default 0 + */ this.c = 0; + + /** + * @property d + * @type Number + * @default 1 + */ this.d = 1; + + /** + * @property tx + * @type Number + * @default 0 + */ this.tx = 0; + + /** + * @property ty + * @type Number + * @default 0 + */ this.ty = 0; }; /** - * Creates a pixi matrix object based on the array given as a parameter + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] * * @method fromArray - * @param array {Array} The array that the matrix will be filled with + * @param array {Array} The array that the matrix will be populated from. */ PIXI.Matrix.prototype.fromArray = function(array) { @@ -39,7 +81,7 @@ }; /** - * Creates an array from the current Matrix object + * Creates an array from the current Matrix object. * * @method toArray * @param transpose {Boolean} Whether we need to transpose the matrix or not @@ -79,13 +121,13 @@ }; /** - * Get a new position with the current transormation applied. + * Get a new position with the current transformation applied. * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) * * @method apply * @param pos {Point} The origin * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input) - * @return {Point} The new point, transformed trough this matrix + * @return {Point} The new point, transformed through this matrix */ PIXI.Matrix.prototype.apply = function(pos, newPos) { @@ -98,13 +140,13 @@ }; /** - * Get a new position with the inverse of the current transormation applied. + * Get a new position with the inverse of the current transformation applied. * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) * - * @method apply + * @method applyInverse * @param pos {Point} The origin * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input) - * @return {Point} The new point, inverse-transformed trough this matrix + * @return {Point} The new point, inverse-transformed through this matrix */ PIXI.Matrix.prototype.applyInverse = function(pos, newPos) { @@ -119,6 +161,7 @@ /** * Translates the matrix on the x and y. + * * @method translate * @param {Number} x * @param {Number} y @@ -134,6 +177,7 @@ /** * Applies a scale transformation to the matrix. + * * @method scale * @param {Number} x The amount to scale horizontally * @param {Number} y The amount to scale vertically @@ -177,14 +221,13 @@ return this; }; - /** - * Translates the matrix on the x and y. - * @method translate - * @param {Number} x - * @param {Number} y + * Appends the given Matrix to this Matrix. + * + * @method append + * @param {Matrix} matrix * @return {Matrix} This matrix. Good for chaining method calls. - **/ + */ PIXI.Matrix.prototype.append = function(matrix) { var a1 = this.a; @@ -203,6 +246,12 @@ return this; }; +/** + * Resets this Matix to an identity (default) matrix. + * + * @method identity + * @return {Matrix} This matrix. Good for chaining method calls. + */ PIXI.Matrix.prototype.identity = function() { this.a = 1; @@ -211,6 +260,8 @@ this.d = 1; this.tx = 0; this.ty = 0; + + return this; }; PIXI.identityMatrix = new PIXI.Matrix(); diff --git a/src/pixi/geom/Point.js b/src/pixi/geom/Point.js index 202bc2f..2adcb13 100644 --- a/src/pixi/geom/Point.js +++ b/src/pixi/geom/Point.js @@ -40,7 +40,7 @@ /** * Sets the point to a new x and y position. - * If y is ommited, both x and y will be set to x. + * If y is omitted, both x and y will be set to x. * * @method set * @param [x=0] {Number} position of the point on the x axis diff --git a/src/pixi/geom/Circle.js b/src/pixi/geom/Circle.js index cc39a28..541e0fe 100644 --- a/src/pixi/geom/Circle.js +++ b/src/pixi/geom/Circle.js @@ -39,7 +39,7 @@ * Creates a clone of this Circle instance * * @method clone - * @return {Circle} a copy of the polygon + * @return {Circle} a copy of the Circle */ PIXI.Circle.prototype.clone = function() { @@ -47,12 +47,12 @@ }; /** - * Checks whether the x, and y coordinates passed to this function are contained within this circle + * Checks whether the x and y coordinates given are contained within this circle * * @method contains * @param x {Number} The X coordinate of the point to test * @param y {Number} The Y coordinate of the point to test - * @return {Boolean} Whether the x/y coordinates are within this polygon + * @return {Boolean} Whether the x/y coordinates are within this Circle */ PIXI.Circle.prototype.contains = function(x, y) { @@ -82,4 +82,3 @@ // constructor PIXI.Circle.prototype.constructor = PIXI.Circle; - diff --git a/src/pixi/geom/Ellipse.js b/src/pixi/geom/Ellipse.js index b376333..0dd71f3 100644 --- a/src/pixi/geom/Ellipse.js +++ b/src/pixi/geom/Ellipse.js @@ -55,7 +55,7 @@ }; /** - * Checks whether the x and y coordinates passed to this function are contained within this ellipse + * Checks whether the x and y coordinates given are contained within this ellipse * * @method contains * @param x {Number} The X coordinate of the point to test diff --git a/src/pixi/geom/Matrix.js b/src/pixi/geom/Matrix.js index 5e73cdd..e12d0e8 100644 --- a/src/pixi/geom/Matrix.js +++ b/src/pixi/geom/Matrix.js @@ -14,19 +14,61 @@ */ PIXI.Matrix = function() { + /** + * @property a + * @type Number + * @default 1 + */ this.a = 1; + + /** + * @property b + * @type Number + * @default 0 + */ this.b = 0; + + /** + * @property c + * @type Number + * @default 0 + */ this.c = 0; + + /** + * @property d + * @type Number + * @default 1 + */ this.d = 1; + + /** + * @property tx + * @type Number + * @default 0 + */ this.tx = 0; + + /** + * @property ty + * @type Number + * @default 0 + */ this.ty = 0; }; /** - * Creates a pixi matrix object based on the array given as a parameter + * Creates a Matrix object based on the given array. The Element to Matrix mapping order is as follows: + * + * a = array[0] + * b = array[1] + * c = array[3] + * d = array[4] + * tx = array[2] + * ty = array[5] * * @method fromArray - * @param array {Array} The array that the matrix will be filled with + * @param array {Array} The array that the matrix will be populated from. */ PIXI.Matrix.prototype.fromArray = function(array) { @@ -39,7 +81,7 @@ }; /** - * Creates an array from the current Matrix object + * Creates an array from the current Matrix object. * * @method toArray * @param transpose {Boolean} Whether we need to transpose the matrix or not @@ -79,13 +121,13 @@ }; /** - * Get a new position with the current transormation applied. + * Get a new position with the current transformation applied. * Can be used to go from a child's coordinate space to the world coordinate space. (e.g. rendering) * * @method apply * @param pos {Point} The origin * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input) - * @return {Point} The new point, transformed trough this matrix + * @return {Point} The new point, transformed through this matrix */ PIXI.Matrix.prototype.apply = function(pos, newPos) { @@ -98,13 +140,13 @@ }; /** - * Get a new position with the inverse of the current transormation applied. + * Get a new position with the inverse of the current transformation applied. * Can be used to go from the world coordinate space to a child's coordinate space. (e.g. input) * - * @method apply + * @method applyInverse * @param pos {Point} The origin * @param [newPos] {Point} The point that the new position is assigned to (allowed to be same as input) - * @return {Point} The new point, inverse-transformed trough this matrix + * @return {Point} The new point, inverse-transformed through this matrix */ PIXI.Matrix.prototype.applyInverse = function(pos, newPos) { @@ -119,6 +161,7 @@ /** * Translates the matrix on the x and y. + * * @method translate * @param {Number} x * @param {Number} y @@ -134,6 +177,7 @@ /** * Applies a scale transformation to the matrix. + * * @method scale * @param {Number} x The amount to scale horizontally * @param {Number} y The amount to scale vertically @@ -177,14 +221,13 @@ return this; }; - /** - * Translates the matrix on the x and y. - * @method translate - * @param {Number} x - * @param {Number} y + * Appends the given Matrix to this Matrix. + * + * @method append + * @param {Matrix} matrix * @return {Matrix} This matrix. Good for chaining method calls. - **/ + */ PIXI.Matrix.prototype.append = function(matrix) { var a1 = this.a; @@ -203,6 +246,12 @@ return this; }; +/** + * Resets this Matix to an identity (default) matrix. + * + * @method identity + * @return {Matrix} This matrix. Good for chaining method calls. + */ PIXI.Matrix.prototype.identity = function() { this.a = 1; @@ -211,6 +260,8 @@ this.d = 1; this.tx = 0; this.ty = 0; + + return this; }; PIXI.identityMatrix = new PIXI.Matrix(); diff --git a/src/pixi/geom/Point.js b/src/pixi/geom/Point.js index 202bc2f..2adcb13 100644 --- a/src/pixi/geom/Point.js +++ b/src/pixi/geom/Point.js @@ -40,7 +40,7 @@ /** * Sets the point to a new x and y position. - * If y is ommited, both x and y will be set to x. + * If y is omitted, both x and y will be set to x. * * @method set * @param [x=0] {Number} position of the point on the x axis diff --git a/src/pixi/geom/Rectangle.js b/src/pixi/geom/Rectangle.js index b8edfcc..2ccd1d1 100644 --- a/src/pixi/geom/Rectangle.js +++ b/src/pixi/geom/Rectangle.js @@ -7,8 +7,8 @@ * * @class Rectangle * @constructor - * @param x {Number} The X coord of the upper-left corner of the rectangle - * @param y {Number} The Y coord of the upper-left corner of the rectangle + * @param x {Number} The X coordinate of the upper-left corner of the rectangle + * @param y {Number} The Y coordinate of the upper-left corner of the rectangle * @param width {Number} The overall width of this rectangle * @param height {Number} The overall height of this rectangle */ @@ -55,12 +55,12 @@ }; /** - * Checks whether the x and y coordinates passed to this function are contained within this Rectangle + * Checks whether the x and y coordinates given are contained within this Rectangle * * @method contains * @param x {Number} The X coordinate of the point to test * @param y {Number} The Y coordinate of the point to test - * @return {Boolean} Whether the x/y coords are within this Rectangle + * @return {Boolean} Whether the x/y coordinates are within this Rectangle */ PIXI.Rectangle.prototype.contains = function(x, y) {