diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index be0e872..78ec4ea 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -134,32 +134,28 @@ * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform - * @type Mat3 + * @type Matrix * @readOnly * @private */ this.worldTransform = new PIXI.Matrix(); /** - * [NYI] Unknown + * cached sin rotation and cos rotation * - * @property color - * @type Array<> + * @property _sr + * @type Number * @private */ - this.color = []; + this._sr = 0; /** - * [NYI] Holds whether or not this object is dynamic, for rendering optimization + * cached sin rotation and cos rotation * - * @property dynamic - * @type Boolean + * @property _cr + * @type Number * @private */ - this.dynamic = true; - - // cached sin rotation and cos rotation - this._sr = 0; this._cr = 1; /** @@ -179,6 +175,7 @@ * @private */ this._bounds = new PIXI.Rectangle(0, 0, 1, 1); + /** * The most up-to-date bounds of the object * @@ -187,6 +184,7 @@ * @private */ this._currentBounds = null; + /** * The original, cached mask of the object * @@ -196,7 +194,22 @@ */ this._mask = null; + /** + * Cached internal flag. + * + * @property _cacheAsBitmap + * @type Boolean + * @private + */ this._cacheAsBitmap = false; + + /** + * Cached internal flag. + * + * @property _cacheIsDirty + * @type Boolean + * @private + */ this._cacheIsDirty = false; @@ -305,19 +318,6 @@ PIXI.DisplayObject.prototype.constructor = PIXI.DisplayObject; /** - * [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default - * Instead of using this function you can now simply set the interactive property to true or false - * - * @method setInteractive - * @param interactive {Boolean} - * @deprecated Simply set the `interactive` property directly - */ -PIXI.DisplayObject.prototype.setInteractive = function(interactive) -{ - this.interactive = interactive; -}; - -/** * Indicates if the sprite will have touch and mouse interactivity. It is false by default * * @property interactive @@ -338,7 +338,7 @@ }); /** - * [read-only] Indicates if the sprite is globaly visible. + * [read-only] Indicates if the sprite is globally visible. * * @property worldVisible * @type Boolean @@ -386,9 +386,11 @@ * @type Array An array of filters */ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { + get: function() { return this._filters; }, + set: function(value) { if(value) @@ -413,23 +415,24 @@ }); /** - * Set weather or not a the display objects is cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects - * To remove filters simply set this property to 'null' + * Set if this display object is cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'null' * @property cacheAsBitmap * @type Boolean */ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', { + get: function() { return this._cacheAsBitmap; }, + set: function(value) { if(this._cacheAsBitmap === value)return; if(value) { - //this._cacheIsDirty = true; this._generateCachedSprite(); } else @@ -517,9 +520,10 @@ * Retrieves the bounds of the displayObject as a rectangle object * * @method getBounds + * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -PIXI.DisplayObject.prototype.getBounds = function( matrix ) +PIXI.DisplayObject.prototype.getBounds = function(matrix) { matrix = matrix;//just to get passed js hinting (and preserve inheritance) return PIXI.EmptyRectangle; @@ -555,6 +559,7 @@ * @method generateTexture * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} Should be one of the PIXI.scaleMode consts + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @return {Texture} a texture of the graphics object */ PIXI.DisplayObject.prototype.generateTexture = function(resolution, scaleMode, renderer) @@ -567,6 +572,11 @@ return renderTexture; }; +/** + * Generates and updates the cached sprite for this object. + * + * @method updateCache + */ PIXI.DisplayObject.prototype.updateCache = function() { this._generateCachedSprite(); @@ -579,30 +589,39 @@ * @param position {Point} The world origin to calculate from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toGlobal = function(pos) +PIXI.DisplayObject.prototype.toGlobal = function(position) { this.updateTransform(); - return this.worldTransform.apply(pos); + return this.worldTransform.apply(position); }; /** * Calculates the local position of the display object relative to another point * - * @method toGlobal + * @method toLocal * @param position {Point} The world origin to calculate from * @param [from] {DisplayObject} The DisplayObject to calculate the global position from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toLocal = function(pos, from) +PIXI.DisplayObject.prototype.toLocal = function(position, from) { if (from) { - pos = from.toGlobal(pos); + position = from.toGlobal(position); } + this.updateTransform(); - return this.worldTransform.applyInverse(pos); + + return this.worldTransform.applyInverse(position); }; +/** + * Internal method. + * + * @method _renderCachedSprite + * @param renderSession {Object} The render session + * @private + */ PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) { this._cachedSprite.worldAlpha = this.worldAlpha; @@ -617,7 +636,13 @@ } }; -PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession) +/** + * Internal method. + * + * @method _generateCachedSprite + * @private + */ +PIXI.DisplayObject.prototype._generateCachedSprite = function() { this._cacheAsBitmap = false; var bounds = this.getLocalBounds(); @@ -654,10 +679,9 @@ }; /** -* Renders the object using the WebGL renderer +* Destroys the cached sprite. * -* @method _renderWebGL -* @param renderSession {RenderSession} +* @method _destroyCachedSprite * @private */ PIXI.DisplayObject.prototype._destroyCachedSprite = function() @@ -665,13 +689,18 @@ if(!this._cachedSprite)return; this._cachedSprite.texture.destroy(true); - // console.log("DESTROY") - // let the gc collect the unused sprite + // TODO could be object pooled! this._cachedSprite = null; }; - +/** +* Renders the object using the WebGL renderer +* +* @method _renderWebGL +* @param renderSession {RenderSession} +* @private +*/ PIXI.DisplayObject.prototype._renderWebGL = function(renderSession) { // OVERWRITE; @@ -725,5 +754,3 @@ this.position.y = value; } }); - - diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index be0e872..78ec4ea 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -134,32 +134,28 @@ * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform - * @type Mat3 + * @type Matrix * @readOnly * @private */ this.worldTransform = new PIXI.Matrix(); /** - * [NYI] Unknown + * cached sin rotation and cos rotation * - * @property color - * @type Array<> + * @property _sr + * @type Number * @private */ - this.color = []; + this._sr = 0; /** - * [NYI] Holds whether or not this object is dynamic, for rendering optimization + * cached sin rotation and cos rotation * - * @property dynamic - * @type Boolean + * @property _cr + * @type Number * @private */ - this.dynamic = true; - - // cached sin rotation and cos rotation - this._sr = 0; this._cr = 1; /** @@ -179,6 +175,7 @@ * @private */ this._bounds = new PIXI.Rectangle(0, 0, 1, 1); + /** * The most up-to-date bounds of the object * @@ -187,6 +184,7 @@ * @private */ this._currentBounds = null; + /** * The original, cached mask of the object * @@ -196,7 +194,22 @@ */ this._mask = null; + /** + * Cached internal flag. + * + * @property _cacheAsBitmap + * @type Boolean + * @private + */ this._cacheAsBitmap = false; + + /** + * Cached internal flag. + * + * @property _cacheIsDirty + * @type Boolean + * @private + */ this._cacheIsDirty = false; @@ -305,19 +318,6 @@ PIXI.DisplayObject.prototype.constructor = PIXI.DisplayObject; /** - * [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default - * Instead of using this function you can now simply set the interactive property to true or false - * - * @method setInteractive - * @param interactive {Boolean} - * @deprecated Simply set the `interactive` property directly - */ -PIXI.DisplayObject.prototype.setInteractive = function(interactive) -{ - this.interactive = interactive; -}; - -/** * Indicates if the sprite will have touch and mouse interactivity. It is false by default * * @property interactive @@ -338,7 +338,7 @@ }); /** - * [read-only] Indicates if the sprite is globaly visible. + * [read-only] Indicates if the sprite is globally visible. * * @property worldVisible * @type Boolean @@ -386,9 +386,11 @@ * @type Array An array of filters */ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { + get: function() { return this._filters; }, + set: function(value) { if(value) @@ -413,23 +415,24 @@ }); /** - * Set weather or not a the display objects is cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects - * To remove filters simply set this property to 'null' + * Set if this display object is cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'null' * @property cacheAsBitmap * @type Boolean */ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', { + get: function() { return this._cacheAsBitmap; }, + set: function(value) { if(this._cacheAsBitmap === value)return; if(value) { - //this._cacheIsDirty = true; this._generateCachedSprite(); } else @@ -517,9 +520,10 @@ * Retrieves the bounds of the displayObject as a rectangle object * * @method getBounds + * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -PIXI.DisplayObject.prototype.getBounds = function( matrix ) +PIXI.DisplayObject.prototype.getBounds = function(matrix) { matrix = matrix;//just to get passed js hinting (and preserve inheritance) return PIXI.EmptyRectangle; @@ -555,6 +559,7 @@ * @method generateTexture * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} Should be one of the PIXI.scaleMode consts + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @return {Texture} a texture of the graphics object */ PIXI.DisplayObject.prototype.generateTexture = function(resolution, scaleMode, renderer) @@ -567,6 +572,11 @@ return renderTexture; }; +/** + * Generates and updates the cached sprite for this object. + * + * @method updateCache + */ PIXI.DisplayObject.prototype.updateCache = function() { this._generateCachedSprite(); @@ -579,30 +589,39 @@ * @param position {Point} The world origin to calculate from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toGlobal = function(pos) +PIXI.DisplayObject.prototype.toGlobal = function(position) { this.updateTransform(); - return this.worldTransform.apply(pos); + return this.worldTransform.apply(position); }; /** * Calculates the local position of the display object relative to another point * - * @method toGlobal + * @method toLocal * @param position {Point} The world origin to calculate from * @param [from] {DisplayObject} The DisplayObject to calculate the global position from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toLocal = function(pos, from) +PIXI.DisplayObject.prototype.toLocal = function(position, from) { if (from) { - pos = from.toGlobal(pos); + position = from.toGlobal(position); } + this.updateTransform(); - return this.worldTransform.applyInverse(pos); + + return this.worldTransform.applyInverse(position); }; +/** + * Internal method. + * + * @method _renderCachedSprite + * @param renderSession {Object} The render session + * @private + */ PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) { this._cachedSprite.worldAlpha = this.worldAlpha; @@ -617,7 +636,13 @@ } }; -PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession) +/** + * Internal method. + * + * @method _generateCachedSprite + * @private + */ +PIXI.DisplayObject.prototype._generateCachedSprite = function() { this._cacheAsBitmap = false; var bounds = this.getLocalBounds(); @@ -654,10 +679,9 @@ }; /** -* Renders the object using the WebGL renderer +* Destroys the cached sprite. * -* @method _renderWebGL -* @param renderSession {RenderSession} +* @method _destroyCachedSprite * @private */ PIXI.DisplayObject.prototype._destroyCachedSprite = function() @@ -665,13 +689,18 @@ if(!this._cachedSprite)return; this._cachedSprite.texture.destroy(true); - // console.log("DESTROY") - // let the gc collect the unused sprite + // TODO could be object pooled! this._cachedSprite = null; }; - +/** +* Renders the object using the WebGL renderer +* +* @method _renderWebGL +* @param renderSession {RenderSession} +* @private +*/ PIXI.DisplayObject.prototype._renderWebGL = function(renderSession) { // OVERWRITE; @@ -725,5 +754,3 @@ this.position.y = value; } }); - - diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 93e4f5c..3bee268 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -2,7 +2,6 @@ * @author Mat Groves http://matgroves.com/ @Doormat23 */ - /** * A DisplayObjectContainer represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. @@ -35,8 +34,6 @@ * @property width * @type Number */ - - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', { get: function() { return this.scale.x * this.getLocalBounds().width; @@ -59,14 +56,12 @@ } }); - /** * The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set * * @property height * @type Number */ - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', { get: function() { return this.scale.y * this.getLocalBounds().height; @@ -88,12 +83,12 @@ } }); - /** * Adds a child to the container. * * @method addChild * @param child {DisplayObject} The DisplayObject to add to the container + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChild = function(child) { @@ -106,6 +101,7 @@ * @method addChildAt * @param child {DisplayObject} The child to add * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) { @@ -131,12 +127,11 @@ }; /** - * [NYI] Swaps the depth of 2 displayObjects + * Swaps the position of 2 Display Objects within this container. * * @method swapChildren * @param child {DisplayObject} * @param child2 {DisplayObject} - * @private */ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) { @@ -153,7 +148,6 @@ this.children[index1] = child2; this.children[index2] = child; - }; @@ -197,6 +191,7 @@ * * @method getChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child at the given index, if any. */ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) { @@ -213,6 +208,7 @@ * * @method removeChild * @param child {DisplayObject} The DisplayObject to remove + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChild = function(child) { @@ -223,10 +219,11 @@ }; /** - * Removes a child from the specified index position in the child list of the container. + * Removes a child from the specified index position. * * @method removeChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChildAt = function(index) { @@ -240,11 +237,11 @@ }; /** -* Removes all child instances from the child list of the container. +* Removes all children from this container that are within the begin and end indexes. * * @method removeChildren -* @param beginIndex {Number} The beginning position. Predefined value is 0. -* @param endIndex {Number} The ending position. Predefined value is children's array length. +* @param beginIndex {Number} The beginning position. Default value is 0. +* @param endIndex {Number} The ending position. Default value is size of the container. */ PIXI.DisplayObjectContainer.prototype.removeChildren = function(beginIndex, endIndex) { @@ -274,7 +271,7 @@ }; /* - * Updates the container's childrens transform for rendering + * Updates the transform on all children of this container for rendering * * @method updateTransform * @private @@ -294,10 +291,10 @@ }; /** - * Retrieves the bounds of the displayObjectContainer as a rectangle object + * Retrieves the bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration. * * @method getBounds - * @return {Rectangle} the rectangular bounding area + * @return {Rectangle} The rectangular bounding area */ PIXI.DisplayObjectContainer.prototype.getBounds = function(matrix) { @@ -360,6 +357,12 @@ return bounds; }; +/** + * Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration. + * + * @method getLocalBounds + * @return {Rectangle} The rectangular bounding area + */ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function() { var matrixCache = this.worldTransform; @@ -379,7 +382,7 @@ }; /** - * Sets the container's stage reference, the stage this object is connected to + * Sets the containers Stage reference. This is the Stage that this object, and all of its children, is connected to. * * @method setStageReference * @param stage {Stage} the stage that the container will have as its current stage reference @@ -397,7 +400,7 @@ }; /** - * removes the current stage reference of the container + * Removes the current stage reference from the container and all of its children. * * @method removeStageReference */ diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index be0e872..78ec4ea 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -134,32 +134,28 @@ * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform - * @type Mat3 + * @type Matrix * @readOnly * @private */ this.worldTransform = new PIXI.Matrix(); /** - * [NYI] Unknown + * cached sin rotation and cos rotation * - * @property color - * @type Array<> + * @property _sr + * @type Number * @private */ - this.color = []; + this._sr = 0; /** - * [NYI] Holds whether or not this object is dynamic, for rendering optimization + * cached sin rotation and cos rotation * - * @property dynamic - * @type Boolean + * @property _cr + * @type Number * @private */ - this.dynamic = true; - - // cached sin rotation and cos rotation - this._sr = 0; this._cr = 1; /** @@ -179,6 +175,7 @@ * @private */ this._bounds = new PIXI.Rectangle(0, 0, 1, 1); + /** * The most up-to-date bounds of the object * @@ -187,6 +184,7 @@ * @private */ this._currentBounds = null; + /** * The original, cached mask of the object * @@ -196,7 +194,22 @@ */ this._mask = null; + /** + * Cached internal flag. + * + * @property _cacheAsBitmap + * @type Boolean + * @private + */ this._cacheAsBitmap = false; + + /** + * Cached internal flag. + * + * @property _cacheIsDirty + * @type Boolean + * @private + */ this._cacheIsDirty = false; @@ -305,19 +318,6 @@ PIXI.DisplayObject.prototype.constructor = PIXI.DisplayObject; /** - * [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default - * Instead of using this function you can now simply set the interactive property to true or false - * - * @method setInteractive - * @param interactive {Boolean} - * @deprecated Simply set the `interactive` property directly - */ -PIXI.DisplayObject.prototype.setInteractive = function(interactive) -{ - this.interactive = interactive; -}; - -/** * Indicates if the sprite will have touch and mouse interactivity. It is false by default * * @property interactive @@ -338,7 +338,7 @@ }); /** - * [read-only] Indicates if the sprite is globaly visible. + * [read-only] Indicates if the sprite is globally visible. * * @property worldVisible * @type Boolean @@ -386,9 +386,11 @@ * @type Array An array of filters */ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { + get: function() { return this._filters; }, + set: function(value) { if(value) @@ -413,23 +415,24 @@ }); /** - * Set weather or not a the display objects is cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects - * To remove filters simply set this property to 'null' + * Set if this display object is cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'null' * @property cacheAsBitmap * @type Boolean */ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', { + get: function() { return this._cacheAsBitmap; }, + set: function(value) { if(this._cacheAsBitmap === value)return; if(value) { - //this._cacheIsDirty = true; this._generateCachedSprite(); } else @@ -517,9 +520,10 @@ * Retrieves the bounds of the displayObject as a rectangle object * * @method getBounds + * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -PIXI.DisplayObject.prototype.getBounds = function( matrix ) +PIXI.DisplayObject.prototype.getBounds = function(matrix) { matrix = matrix;//just to get passed js hinting (and preserve inheritance) return PIXI.EmptyRectangle; @@ -555,6 +559,7 @@ * @method generateTexture * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} Should be one of the PIXI.scaleMode consts + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @return {Texture} a texture of the graphics object */ PIXI.DisplayObject.prototype.generateTexture = function(resolution, scaleMode, renderer) @@ -567,6 +572,11 @@ return renderTexture; }; +/** + * Generates and updates the cached sprite for this object. + * + * @method updateCache + */ PIXI.DisplayObject.prototype.updateCache = function() { this._generateCachedSprite(); @@ -579,30 +589,39 @@ * @param position {Point} The world origin to calculate from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toGlobal = function(pos) +PIXI.DisplayObject.prototype.toGlobal = function(position) { this.updateTransform(); - return this.worldTransform.apply(pos); + return this.worldTransform.apply(position); }; /** * Calculates the local position of the display object relative to another point * - * @method toGlobal + * @method toLocal * @param position {Point} The world origin to calculate from * @param [from] {DisplayObject} The DisplayObject to calculate the global position from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toLocal = function(pos, from) +PIXI.DisplayObject.prototype.toLocal = function(position, from) { if (from) { - pos = from.toGlobal(pos); + position = from.toGlobal(position); } + this.updateTransform(); - return this.worldTransform.applyInverse(pos); + + return this.worldTransform.applyInverse(position); }; +/** + * Internal method. + * + * @method _renderCachedSprite + * @param renderSession {Object} The render session + * @private + */ PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) { this._cachedSprite.worldAlpha = this.worldAlpha; @@ -617,7 +636,13 @@ } }; -PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession) +/** + * Internal method. + * + * @method _generateCachedSprite + * @private + */ +PIXI.DisplayObject.prototype._generateCachedSprite = function() { this._cacheAsBitmap = false; var bounds = this.getLocalBounds(); @@ -654,10 +679,9 @@ }; /** -* Renders the object using the WebGL renderer +* Destroys the cached sprite. * -* @method _renderWebGL -* @param renderSession {RenderSession} +* @method _destroyCachedSprite * @private */ PIXI.DisplayObject.prototype._destroyCachedSprite = function() @@ -665,13 +689,18 @@ if(!this._cachedSprite)return; this._cachedSprite.texture.destroy(true); - // console.log("DESTROY") - // let the gc collect the unused sprite + // TODO could be object pooled! this._cachedSprite = null; }; - +/** +* Renders the object using the WebGL renderer +* +* @method _renderWebGL +* @param renderSession {RenderSession} +* @private +*/ PIXI.DisplayObject.prototype._renderWebGL = function(renderSession) { // OVERWRITE; @@ -725,5 +754,3 @@ this.position.y = value; } }); - - diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 93e4f5c..3bee268 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -2,7 +2,6 @@ * @author Mat Groves http://matgroves.com/ @Doormat23 */ - /** * A DisplayObjectContainer represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. @@ -35,8 +34,6 @@ * @property width * @type Number */ - - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', { get: function() { return this.scale.x * this.getLocalBounds().width; @@ -59,14 +56,12 @@ } }); - /** * The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set * * @property height * @type Number */ - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', { get: function() { return this.scale.y * this.getLocalBounds().height; @@ -88,12 +83,12 @@ } }); - /** * Adds a child to the container. * * @method addChild * @param child {DisplayObject} The DisplayObject to add to the container + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChild = function(child) { @@ -106,6 +101,7 @@ * @method addChildAt * @param child {DisplayObject} The child to add * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) { @@ -131,12 +127,11 @@ }; /** - * [NYI] Swaps the depth of 2 displayObjects + * Swaps the position of 2 Display Objects within this container. * * @method swapChildren * @param child {DisplayObject} * @param child2 {DisplayObject} - * @private */ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) { @@ -153,7 +148,6 @@ this.children[index1] = child2; this.children[index2] = child; - }; @@ -197,6 +191,7 @@ * * @method getChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child at the given index, if any. */ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) { @@ -213,6 +208,7 @@ * * @method removeChild * @param child {DisplayObject} The DisplayObject to remove + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChild = function(child) { @@ -223,10 +219,11 @@ }; /** - * Removes a child from the specified index position in the child list of the container. + * Removes a child from the specified index position. * * @method removeChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChildAt = function(index) { @@ -240,11 +237,11 @@ }; /** -* Removes all child instances from the child list of the container. +* Removes all children from this container that are within the begin and end indexes. * * @method removeChildren -* @param beginIndex {Number} The beginning position. Predefined value is 0. -* @param endIndex {Number} The ending position. Predefined value is children's array length. +* @param beginIndex {Number} The beginning position. Default value is 0. +* @param endIndex {Number} The ending position. Default value is size of the container. */ PIXI.DisplayObjectContainer.prototype.removeChildren = function(beginIndex, endIndex) { @@ -274,7 +271,7 @@ }; /* - * Updates the container's childrens transform for rendering + * Updates the transform on all children of this container for rendering * * @method updateTransform * @private @@ -294,10 +291,10 @@ }; /** - * Retrieves the bounds of the displayObjectContainer as a rectangle object + * Retrieves the bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration. * * @method getBounds - * @return {Rectangle} the rectangular bounding area + * @return {Rectangle} The rectangular bounding area */ PIXI.DisplayObjectContainer.prototype.getBounds = function(matrix) { @@ -360,6 +357,12 @@ return bounds; }; +/** + * Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration. + * + * @method getLocalBounds + * @return {Rectangle} The rectangular bounding area + */ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function() { var matrixCache = this.worldTransform; @@ -379,7 +382,7 @@ }; /** - * Sets the container's stage reference, the stage this object is connected to + * Sets the containers Stage reference. This is the Stage that this object, and all of its children, is connected to. * * @method setStageReference * @param stage {Stage} the stage that the container will have as its current stage reference @@ -397,7 +400,7 @@ }; /** - * removes the current stage reference of the container + * Removes the current stage reference from the container and all of its children. * * @method removeStageReference */ diff --git a/src/pixi/display/MovieClip.js b/src/pixi/display/MovieClip.js index 70ad553..05b51b8 100644 --- a/src/pixi/display/MovieClip.js +++ b/src/pixi/display/MovieClip.js @@ -88,7 +88,6 @@ } }); - /** * Stops the MovieClip * @@ -203,4 +202,4 @@ } return new PIXI.MovieClip(textures); -}; \ No newline at end of file +}; diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index be0e872..78ec4ea 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -134,32 +134,28 @@ * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform - * @type Mat3 + * @type Matrix * @readOnly * @private */ this.worldTransform = new PIXI.Matrix(); /** - * [NYI] Unknown + * cached sin rotation and cos rotation * - * @property color - * @type Array<> + * @property _sr + * @type Number * @private */ - this.color = []; + this._sr = 0; /** - * [NYI] Holds whether or not this object is dynamic, for rendering optimization + * cached sin rotation and cos rotation * - * @property dynamic - * @type Boolean + * @property _cr + * @type Number * @private */ - this.dynamic = true; - - // cached sin rotation and cos rotation - this._sr = 0; this._cr = 1; /** @@ -179,6 +175,7 @@ * @private */ this._bounds = new PIXI.Rectangle(0, 0, 1, 1); + /** * The most up-to-date bounds of the object * @@ -187,6 +184,7 @@ * @private */ this._currentBounds = null; + /** * The original, cached mask of the object * @@ -196,7 +194,22 @@ */ this._mask = null; + /** + * Cached internal flag. + * + * @property _cacheAsBitmap + * @type Boolean + * @private + */ this._cacheAsBitmap = false; + + /** + * Cached internal flag. + * + * @property _cacheIsDirty + * @type Boolean + * @private + */ this._cacheIsDirty = false; @@ -305,19 +318,6 @@ PIXI.DisplayObject.prototype.constructor = PIXI.DisplayObject; /** - * [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default - * Instead of using this function you can now simply set the interactive property to true or false - * - * @method setInteractive - * @param interactive {Boolean} - * @deprecated Simply set the `interactive` property directly - */ -PIXI.DisplayObject.prototype.setInteractive = function(interactive) -{ - this.interactive = interactive; -}; - -/** * Indicates if the sprite will have touch and mouse interactivity. It is false by default * * @property interactive @@ -338,7 +338,7 @@ }); /** - * [read-only] Indicates if the sprite is globaly visible. + * [read-only] Indicates if the sprite is globally visible. * * @property worldVisible * @type Boolean @@ -386,9 +386,11 @@ * @type Array An array of filters */ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { + get: function() { return this._filters; }, + set: function(value) { if(value) @@ -413,23 +415,24 @@ }); /** - * Set weather or not a the display objects is cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects - * To remove filters simply set this property to 'null' + * Set if this display object is cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'null' * @property cacheAsBitmap * @type Boolean */ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', { + get: function() { return this._cacheAsBitmap; }, + set: function(value) { if(this._cacheAsBitmap === value)return; if(value) { - //this._cacheIsDirty = true; this._generateCachedSprite(); } else @@ -517,9 +520,10 @@ * Retrieves the bounds of the displayObject as a rectangle object * * @method getBounds + * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -PIXI.DisplayObject.prototype.getBounds = function( matrix ) +PIXI.DisplayObject.prototype.getBounds = function(matrix) { matrix = matrix;//just to get passed js hinting (and preserve inheritance) return PIXI.EmptyRectangle; @@ -555,6 +559,7 @@ * @method generateTexture * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} Should be one of the PIXI.scaleMode consts + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @return {Texture} a texture of the graphics object */ PIXI.DisplayObject.prototype.generateTexture = function(resolution, scaleMode, renderer) @@ -567,6 +572,11 @@ return renderTexture; }; +/** + * Generates and updates the cached sprite for this object. + * + * @method updateCache + */ PIXI.DisplayObject.prototype.updateCache = function() { this._generateCachedSprite(); @@ -579,30 +589,39 @@ * @param position {Point} The world origin to calculate from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toGlobal = function(pos) +PIXI.DisplayObject.prototype.toGlobal = function(position) { this.updateTransform(); - return this.worldTransform.apply(pos); + return this.worldTransform.apply(position); }; /** * Calculates the local position of the display object relative to another point * - * @method toGlobal + * @method toLocal * @param position {Point} The world origin to calculate from * @param [from] {DisplayObject} The DisplayObject to calculate the global position from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toLocal = function(pos, from) +PIXI.DisplayObject.prototype.toLocal = function(position, from) { if (from) { - pos = from.toGlobal(pos); + position = from.toGlobal(position); } + this.updateTransform(); - return this.worldTransform.applyInverse(pos); + + return this.worldTransform.applyInverse(position); }; +/** + * Internal method. + * + * @method _renderCachedSprite + * @param renderSession {Object} The render session + * @private + */ PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) { this._cachedSprite.worldAlpha = this.worldAlpha; @@ -617,7 +636,13 @@ } }; -PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession) +/** + * Internal method. + * + * @method _generateCachedSprite + * @private + */ +PIXI.DisplayObject.prototype._generateCachedSprite = function() { this._cacheAsBitmap = false; var bounds = this.getLocalBounds(); @@ -654,10 +679,9 @@ }; /** -* Renders the object using the WebGL renderer +* Destroys the cached sprite. * -* @method _renderWebGL -* @param renderSession {RenderSession} +* @method _destroyCachedSprite * @private */ PIXI.DisplayObject.prototype._destroyCachedSprite = function() @@ -665,13 +689,18 @@ if(!this._cachedSprite)return; this._cachedSprite.texture.destroy(true); - // console.log("DESTROY") - // let the gc collect the unused sprite + // TODO could be object pooled! this._cachedSprite = null; }; - +/** +* Renders the object using the WebGL renderer +* +* @method _renderWebGL +* @param renderSession {RenderSession} +* @private +*/ PIXI.DisplayObject.prototype._renderWebGL = function(renderSession) { // OVERWRITE; @@ -725,5 +754,3 @@ this.position.y = value; } }); - - diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 93e4f5c..3bee268 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -2,7 +2,6 @@ * @author Mat Groves http://matgroves.com/ @Doormat23 */ - /** * A DisplayObjectContainer represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. @@ -35,8 +34,6 @@ * @property width * @type Number */ - - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', { get: function() { return this.scale.x * this.getLocalBounds().width; @@ -59,14 +56,12 @@ } }); - /** * The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set * * @property height * @type Number */ - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', { get: function() { return this.scale.y * this.getLocalBounds().height; @@ -88,12 +83,12 @@ } }); - /** * Adds a child to the container. * * @method addChild * @param child {DisplayObject} The DisplayObject to add to the container + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChild = function(child) { @@ -106,6 +101,7 @@ * @method addChildAt * @param child {DisplayObject} The child to add * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) { @@ -131,12 +127,11 @@ }; /** - * [NYI] Swaps the depth of 2 displayObjects + * Swaps the position of 2 Display Objects within this container. * * @method swapChildren * @param child {DisplayObject} * @param child2 {DisplayObject} - * @private */ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) { @@ -153,7 +148,6 @@ this.children[index1] = child2; this.children[index2] = child; - }; @@ -197,6 +191,7 @@ * * @method getChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child at the given index, if any. */ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) { @@ -213,6 +208,7 @@ * * @method removeChild * @param child {DisplayObject} The DisplayObject to remove + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChild = function(child) { @@ -223,10 +219,11 @@ }; /** - * Removes a child from the specified index position in the child list of the container. + * Removes a child from the specified index position. * * @method removeChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChildAt = function(index) { @@ -240,11 +237,11 @@ }; /** -* Removes all child instances from the child list of the container. +* Removes all children from this container that are within the begin and end indexes. * * @method removeChildren -* @param beginIndex {Number} The beginning position. Predefined value is 0. -* @param endIndex {Number} The ending position. Predefined value is children's array length. +* @param beginIndex {Number} The beginning position. Default value is 0. +* @param endIndex {Number} The ending position. Default value is size of the container. */ PIXI.DisplayObjectContainer.prototype.removeChildren = function(beginIndex, endIndex) { @@ -274,7 +271,7 @@ }; /* - * Updates the container's childrens transform for rendering + * Updates the transform on all children of this container for rendering * * @method updateTransform * @private @@ -294,10 +291,10 @@ }; /** - * Retrieves the bounds of the displayObjectContainer as a rectangle object + * Retrieves the bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration. * * @method getBounds - * @return {Rectangle} the rectangular bounding area + * @return {Rectangle} The rectangular bounding area */ PIXI.DisplayObjectContainer.prototype.getBounds = function(matrix) { @@ -360,6 +357,12 @@ return bounds; }; +/** + * Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration. + * + * @method getLocalBounds + * @return {Rectangle} The rectangular bounding area + */ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function() { var matrixCache = this.worldTransform; @@ -379,7 +382,7 @@ }; /** - * Sets the container's stage reference, the stage this object is connected to + * Sets the containers Stage reference. This is the Stage that this object, and all of its children, is connected to. * * @method setStageReference * @param stage {Stage} the stage that the container will have as its current stage reference @@ -397,7 +400,7 @@ }; /** - * removes the current stage reference of the container + * Removes the current stage reference from the container and all of its children. * * @method removeStageReference */ diff --git a/src/pixi/display/MovieClip.js b/src/pixi/display/MovieClip.js index 70ad553..05b51b8 100644 --- a/src/pixi/display/MovieClip.js +++ b/src/pixi/display/MovieClip.js @@ -88,7 +88,6 @@ } }); - /** * Stops the MovieClip * @@ -203,4 +202,4 @@ } return new PIXI.MovieClip(textures); -}; \ No newline at end of file +}; diff --git a/src/pixi/display/Sprite.js b/src/pixi/display/Sprite.js index de17ba5..5f0b664 100644 --- a/src/pixi/display/Sprite.js +++ b/src/pixi/display/Sprite.js @@ -22,7 +22,7 @@ /** * The anchor sets the origin point of the texture. * The default is 0,0 this means the texture's origin is the top left - * Setting than anchor to 0.5,0.5 means the textures origin is centred + * Setting than anchor to 0.5,0.5 means the textures origin is centered * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right corner * * @property anchor @@ -56,9 +56,8 @@ */ this._height = 0; - /** - * The tint applied to the sprite. This is a hex value + * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. * * @property tint * @type Number @@ -67,7 +66,7 @@ this.tint = 0xFFFFFF; /** - * The blend mode to be applied to the sprite + * The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode. * * @property blendMode * @type Number @@ -75,9 +74,8 @@ */ this.blendMode = PIXI.blendModes.NORMAL; - /** - * The shader that will be used to render the texture to the stage. + * The shader that will be used to render the texture to the stage. Set to null to remove a current shader. * * @property shader * @type PIXI.AbstractFilter @@ -160,12 +158,11 @@ if(this._width)this.scale.x = this._width / this.texture.frame.width; if(this._height)this.scale.y = this._height / this.texture.frame.height; - //this.updateFrame = true; }; /** -* Returns the framing rectangle of the sprite as a PIXI.Rectangle object +* Returns the bounds of the Sprite as a rectangle. The bounds calculation takes the worldTransform into account. * * @method getBounds * @param matrix {Matrix} the transformation matrix of the sprite @@ -173,7 +170,6 @@ */ PIXI.Sprite.prototype.getBounds = function(matrix) { - var width = this.texture.frame.width; var height = this.texture.frame.height; diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index be0e872..78ec4ea 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -134,32 +134,28 @@ * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform - * @type Mat3 + * @type Matrix * @readOnly * @private */ this.worldTransform = new PIXI.Matrix(); /** - * [NYI] Unknown + * cached sin rotation and cos rotation * - * @property color - * @type Array<> + * @property _sr + * @type Number * @private */ - this.color = []; + this._sr = 0; /** - * [NYI] Holds whether or not this object is dynamic, for rendering optimization + * cached sin rotation and cos rotation * - * @property dynamic - * @type Boolean + * @property _cr + * @type Number * @private */ - this.dynamic = true; - - // cached sin rotation and cos rotation - this._sr = 0; this._cr = 1; /** @@ -179,6 +175,7 @@ * @private */ this._bounds = new PIXI.Rectangle(0, 0, 1, 1); + /** * The most up-to-date bounds of the object * @@ -187,6 +184,7 @@ * @private */ this._currentBounds = null; + /** * The original, cached mask of the object * @@ -196,7 +194,22 @@ */ this._mask = null; + /** + * Cached internal flag. + * + * @property _cacheAsBitmap + * @type Boolean + * @private + */ this._cacheAsBitmap = false; + + /** + * Cached internal flag. + * + * @property _cacheIsDirty + * @type Boolean + * @private + */ this._cacheIsDirty = false; @@ -305,19 +318,6 @@ PIXI.DisplayObject.prototype.constructor = PIXI.DisplayObject; /** - * [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default - * Instead of using this function you can now simply set the interactive property to true or false - * - * @method setInteractive - * @param interactive {Boolean} - * @deprecated Simply set the `interactive` property directly - */ -PIXI.DisplayObject.prototype.setInteractive = function(interactive) -{ - this.interactive = interactive; -}; - -/** * Indicates if the sprite will have touch and mouse interactivity. It is false by default * * @property interactive @@ -338,7 +338,7 @@ }); /** - * [read-only] Indicates if the sprite is globaly visible. + * [read-only] Indicates if the sprite is globally visible. * * @property worldVisible * @type Boolean @@ -386,9 +386,11 @@ * @type Array An array of filters */ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { + get: function() { return this._filters; }, + set: function(value) { if(value) @@ -413,23 +415,24 @@ }); /** - * Set weather or not a the display objects is cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects - * To remove filters simply set this property to 'null' + * Set if this display object is cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'null' * @property cacheAsBitmap * @type Boolean */ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', { + get: function() { return this._cacheAsBitmap; }, + set: function(value) { if(this._cacheAsBitmap === value)return; if(value) { - //this._cacheIsDirty = true; this._generateCachedSprite(); } else @@ -517,9 +520,10 @@ * Retrieves the bounds of the displayObject as a rectangle object * * @method getBounds + * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -PIXI.DisplayObject.prototype.getBounds = function( matrix ) +PIXI.DisplayObject.prototype.getBounds = function(matrix) { matrix = matrix;//just to get passed js hinting (and preserve inheritance) return PIXI.EmptyRectangle; @@ -555,6 +559,7 @@ * @method generateTexture * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} Should be one of the PIXI.scaleMode consts + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @return {Texture} a texture of the graphics object */ PIXI.DisplayObject.prototype.generateTexture = function(resolution, scaleMode, renderer) @@ -567,6 +572,11 @@ return renderTexture; }; +/** + * Generates and updates the cached sprite for this object. + * + * @method updateCache + */ PIXI.DisplayObject.prototype.updateCache = function() { this._generateCachedSprite(); @@ -579,30 +589,39 @@ * @param position {Point} The world origin to calculate from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toGlobal = function(pos) +PIXI.DisplayObject.prototype.toGlobal = function(position) { this.updateTransform(); - return this.worldTransform.apply(pos); + return this.worldTransform.apply(position); }; /** * Calculates the local position of the display object relative to another point * - * @method toGlobal + * @method toLocal * @param position {Point} The world origin to calculate from * @param [from] {DisplayObject} The DisplayObject to calculate the global position from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toLocal = function(pos, from) +PIXI.DisplayObject.prototype.toLocal = function(position, from) { if (from) { - pos = from.toGlobal(pos); + position = from.toGlobal(position); } + this.updateTransform(); - return this.worldTransform.applyInverse(pos); + + return this.worldTransform.applyInverse(position); }; +/** + * Internal method. + * + * @method _renderCachedSprite + * @param renderSession {Object} The render session + * @private + */ PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) { this._cachedSprite.worldAlpha = this.worldAlpha; @@ -617,7 +636,13 @@ } }; -PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession) +/** + * Internal method. + * + * @method _generateCachedSprite + * @private + */ +PIXI.DisplayObject.prototype._generateCachedSprite = function() { this._cacheAsBitmap = false; var bounds = this.getLocalBounds(); @@ -654,10 +679,9 @@ }; /** -* Renders the object using the WebGL renderer +* Destroys the cached sprite. * -* @method _renderWebGL -* @param renderSession {RenderSession} +* @method _destroyCachedSprite * @private */ PIXI.DisplayObject.prototype._destroyCachedSprite = function() @@ -665,13 +689,18 @@ if(!this._cachedSprite)return; this._cachedSprite.texture.destroy(true); - // console.log("DESTROY") - // let the gc collect the unused sprite + // TODO could be object pooled! this._cachedSprite = null; }; - +/** +* Renders the object using the WebGL renderer +* +* @method _renderWebGL +* @param renderSession {RenderSession} +* @private +*/ PIXI.DisplayObject.prototype._renderWebGL = function(renderSession) { // OVERWRITE; @@ -725,5 +754,3 @@ this.position.y = value; } }); - - diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 93e4f5c..3bee268 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -2,7 +2,6 @@ * @author Mat Groves http://matgroves.com/ @Doormat23 */ - /** * A DisplayObjectContainer represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. @@ -35,8 +34,6 @@ * @property width * @type Number */ - - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', { get: function() { return this.scale.x * this.getLocalBounds().width; @@ -59,14 +56,12 @@ } }); - /** * The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set * * @property height * @type Number */ - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', { get: function() { return this.scale.y * this.getLocalBounds().height; @@ -88,12 +83,12 @@ } }); - /** * Adds a child to the container. * * @method addChild * @param child {DisplayObject} The DisplayObject to add to the container + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChild = function(child) { @@ -106,6 +101,7 @@ * @method addChildAt * @param child {DisplayObject} The child to add * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) { @@ -131,12 +127,11 @@ }; /** - * [NYI] Swaps the depth of 2 displayObjects + * Swaps the position of 2 Display Objects within this container. * * @method swapChildren * @param child {DisplayObject} * @param child2 {DisplayObject} - * @private */ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) { @@ -153,7 +148,6 @@ this.children[index1] = child2; this.children[index2] = child; - }; @@ -197,6 +191,7 @@ * * @method getChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child at the given index, if any. */ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) { @@ -213,6 +208,7 @@ * * @method removeChild * @param child {DisplayObject} The DisplayObject to remove + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChild = function(child) { @@ -223,10 +219,11 @@ }; /** - * Removes a child from the specified index position in the child list of the container. + * Removes a child from the specified index position. * * @method removeChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChildAt = function(index) { @@ -240,11 +237,11 @@ }; /** -* Removes all child instances from the child list of the container. +* Removes all children from this container that are within the begin and end indexes. * * @method removeChildren -* @param beginIndex {Number} The beginning position. Predefined value is 0. -* @param endIndex {Number} The ending position. Predefined value is children's array length. +* @param beginIndex {Number} The beginning position. Default value is 0. +* @param endIndex {Number} The ending position. Default value is size of the container. */ PIXI.DisplayObjectContainer.prototype.removeChildren = function(beginIndex, endIndex) { @@ -274,7 +271,7 @@ }; /* - * Updates the container's childrens transform for rendering + * Updates the transform on all children of this container for rendering * * @method updateTransform * @private @@ -294,10 +291,10 @@ }; /** - * Retrieves the bounds of the displayObjectContainer as a rectangle object + * Retrieves the bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration. * * @method getBounds - * @return {Rectangle} the rectangular bounding area + * @return {Rectangle} The rectangular bounding area */ PIXI.DisplayObjectContainer.prototype.getBounds = function(matrix) { @@ -360,6 +357,12 @@ return bounds; }; +/** + * Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration. + * + * @method getLocalBounds + * @return {Rectangle} The rectangular bounding area + */ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function() { var matrixCache = this.worldTransform; @@ -379,7 +382,7 @@ }; /** - * Sets the container's stage reference, the stage this object is connected to + * Sets the containers Stage reference. This is the Stage that this object, and all of its children, is connected to. * * @method setStageReference * @param stage {Stage} the stage that the container will have as its current stage reference @@ -397,7 +400,7 @@ }; /** - * removes the current stage reference of the container + * Removes the current stage reference from the container and all of its children. * * @method removeStageReference */ diff --git a/src/pixi/display/MovieClip.js b/src/pixi/display/MovieClip.js index 70ad553..05b51b8 100644 --- a/src/pixi/display/MovieClip.js +++ b/src/pixi/display/MovieClip.js @@ -88,7 +88,6 @@ } }); - /** * Stops the MovieClip * @@ -203,4 +202,4 @@ } return new PIXI.MovieClip(textures); -}; \ No newline at end of file +}; diff --git a/src/pixi/display/Sprite.js b/src/pixi/display/Sprite.js index de17ba5..5f0b664 100644 --- a/src/pixi/display/Sprite.js +++ b/src/pixi/display/Sprite.js @@ -22,7 +22,7 @@ /** * The anchor sets the origin point of the texture. * The default is 0,0 this means the texture's origin is the top left - * Setting than anchor to 0.5,0.5 means the textures origin is centred + * Setting than anchor to 0.5,0.5 means the textures origin is centered * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right corner * * @property anchor @@ -56,9 +56,8 @@ */ this._height = 0; - /** - * The tint applied to the sprite. This is a hex value + * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. * * @property tint * @type Number @@ -67,7 +66,7 @@ this.tint = 0xFFFFFF; /** - * The blend mode to be applied to the sprite + * The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode. * * @property blendMode * @type Number @@ -75,9 +74,8 @@ */ this.blendMode = PIXI.blendModes.NORMAL; - /** - * The shader that will be used to render the texture to the stage. + * The shader that will be used to render the texture to the stage. Set to null to remove a current shader. * * @property shader * @type PIXI.AbstractFilter @@ -160,12 +158,11 @@ if(this._width)this.scale.x = this._width / this.texture.frame.width; if(this._height)this.scale.y = this._height / this.texture.frame.height; - //this.updateFrame = true; }; /** -* Returns the framing rectangle of the sprite as a PIXI.Rectangle object +* Returns the bounds of the Sprite as a rectangle. The bounds calculation takes the worldTransform into account. * * @method getBounds * @param matrix {Matrix} the transformation matrix of the sprite @@ -173,7 +170,6 @@ */ PIXI.Sprite.prototype.getBounds = function(matrix) { - var width = this.texture.frame.width; var height = this.texture.frame.height; diff --git a/src/pixi/display/SpriteBatch.js b/src/pixi/display/SpriteBatch.js index dd732f1..790d696 100644 --- a/src/pixi/display/SpriteBatch.js +++ b/src/pixi/display/SpriteBatch.js @@ -34,7 +34,7 @@ }; PIXI.SpriteBatch.prototype = Object.create(PIXI.DisplayObjectContainer.prototype); -PIXI.SpriteBatch.constructor = PIXI.SpriteBatch; +PIXI.SpriteBatch.prototype.constructor = PIXI.SpriteBatch; /* * Initialises the spriteBatch @@ -58,9 +58,9 @@ */ PIXI.SpriteBatch.prototype.updateTransform = function() { - // TODO dont need to! + // TODO don't need to! PIXI.DisplayObject.prototype.updateTransform.call( this ); - // PIXI.DisplayObjectContainer.prototype.updateTransform.call( this ); + // PIXI.DisplayObjectContainer.prototype.updateTransform.call( this ); }; /** @@ -175,4 +175,3 @@ // context.restore(); }; - diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index be0e872..78ec4ea 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -134,32 +134,28 @@ * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform - * @type Mat3 + * @type Matrix * @readOnly * @private */ this.worldTransform = new PIXI.Matrix(); /** - * [NYI] Unknown + * cached sin rotation and cos rotation * - * @property color - * @type Array<> + * @property _sr + * @type Number * @private */ - this.color = []; + this._sr = 0; /** - * [NYI] Holds whether or not this object is dynamic, for rendering optimization + * cached sin rotation and cos rotation * - * @property dynamic - * @type Boolean + * @property _cr + * @type Number * @private */ - this.dynamic = true; - - // cached sin rotation and cos rotation - this._sr = 0; this._cr = 1; /** @@ -179,6 +175,7 @@ * @private */ this._bounds = new PIXI.Rectangle(0, 0, 1, 1); + /** * The most up-to-date bounds of the object * @@ -187,6 +184,7 @@ * @private */ this._currentBounds = null; + /** * The original, cached mask of the object * @@ -196,7 +194,22 @@ */ this._mask = null; + /** + * Cached internal flag. + * + * @property _cacheAsBitmap + * @type Boolean + * @private + */ this._cacheAsBitmap = false; + + /** + * Cached internal flag. + * + * @property _cacheIsDirty + * @type Boolean + * @private + */ this._cacheIsDirty = false; @@ -305,19 +318,6 @@ PIXI.DisplayObject.prototype.constructor = PIXI.DisplayObject; /** - * [Deprecated] Indicates if the sprite will have touch and mouse interactivity. It is false by default - * Instead of using this function you can now simply set the interactive property to true or false - * - * @method setInteractive - * @param interactive {Boolean} - * @deprecated Simply set the `interactive` property directly - */ -PIXI.DisplayObject.prototype.setInteractive = function(interactive) -{ - this.interactive = interactive; -}; - -/** * Indicates if the sprite will have touch and mouse interactivity. It is false by default * * @property interactive @@ -338,7 +338,7 @@ }); /** - * [read-only] Indicates if the sprite is globaly visible. + * [read-only] Indicates if the sprite is globally visible. * * @property worldVisible * @type Boolean @@ -386,9 +386,11 @@ * @type Array An array of filters */ Object.defineProperty(PIXI.DisplayObject.prototype, 'filters', { + get: function() { return this._filters; }, + set: function(value) { if(value) @@ -413,23 +415,24 @@ }); /** - * Set weather or not a the display objects is cached as a bitmap. - * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects - * To remove filters simply set this property to 'null' + * Set if this display object is cached as a bitmap. + * This basically takes a snap shot of the display object as it is at that moment. It can provide a performance benefit for complex static displayObjects. + * To remove simply set this property to 'null' * @property cacheAsBitmap * @type Boolean */ Object.defineProperty(PIXI.DisplayObject.prototype, 'cacheAsBitmap', { + get: function() { return this._cacheAsBitmap; }, + set: function(value) { if(this._cacheAsBitmap === value)return; if(value) { - //this._cacheIsDirty = true; this._generateCachedSprite(); } else @@ -517,9 +520,10 @@ * Retrieves the bounds of the displayObject as a rectangle object * * @method getBounds + * @param matrix {Matrix} * @return {Rectangle} the rectangular bounding area */ -PIXI.DisplayObject.prototype.getBounds = function( matrix ) +PIXI.DisplayObject.prototype.getBounds = function(matrix) { matrix = matrix;//just to get passed js hinting (and preserve inheritance) return PIXI.EmptyRectangle; @@ -555,6 +559,7 @@ * @method generateTexture * @param resolution {Number} The resolution of the texture being generated * @param scaleMode {Number} Should be one of the PIXI.scaleMode consts + * @param renderer {CanvasRenderer|WebGLRenderer} The renderer used to generate the texture. * @return {Texture} a texture of the graphics object */ PIXI.DisplayObject.prototype.generateTexture = function(resolution, scaleMode, renderer) @@ -567,6 +572,11 @@ return renderTexture; }; +/** + * Generates and updates the cached sprite for this object. + * + * @method updateCache + */ PIXI.DisplayObject.prototype.updateCache = function() { this._generateCachedSprite(); @@ -579,30 +589,39 @@ * @param position {Point} The world origin to calculate from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toGlobal = function(pos) +PIXI.DisplayObject.prototype.toGlobal = function(position) { this.updateTransform(); - return this.worldTransform.apply(pos); + return this.worldTransform.apply(position); }; /** * Calculates the local position of the display object relative to another point * - * @method toGlobal + * @method toLocal * @param position {Point} The world origin to calculate from * @param [from] {DisplayObject} The DisplayObject to calculate the global position from * @return {Point} A point object representing the position of this object */ -PIXI.DisplayObject.prototype.toLocal = function(pos, from) +PIXI.DisplayObject.prototype.toLocal = function(position, from) { if (from) { - pos = from.toGlobal(pos); + position = from.toGlobal(position); } + this.updateTransform(); - return this.worldTransform.applyInverse(pos); + + return this.worldTransform.applyInverse(position); }; +/** + * Internal method. + * + * @method _renderCachedSprite + * @param renderSession {Object} The render session + * @private + */ PIXI.DisplayObject.prototype._renderCachedSprite = function(renderSession) { this._cachedSprite.worldAlpha = this.worldAlpha; @@ -617,7 +636,13 @@ } }; -PIXI.DisplayObject.prototype._generateCachedSprite = function()//renderSession) +/** + * Internal method. + * + * @method _generateCachedSprite + * @private + */ +PIXI.DisplayObject.prototype._generateCachedSprite = function() { this._cacheAsBitmap = false; var bounds = this.getLocalBounds(); @@ -654,10 +679,9 @@ }; /** -* Renders the object using the WebGL renderer +* Destroys the cached sprite. * -* @method _renderWebGL -* @param renderSession {RenderSession} +* @method _destroyCachedSprite * @private */ PIXI.DisplayObject.prototype._destroyCachedSprite = function() @@ -665,13 +689,18 @@ if(!this._cachedSprite)return; this._cachedSprite.texture.destroy(true); - // console.log("DESTROY") - // let the gc collect the unused sprite + // TODO could be object pooled! this._cachedSprite = null; }; - +/** +* Renders the object using the WebGL renderer +* +* @method _renderWebGL +* @param renderSession {RenderSession} +* @private +*/ PIXI.DisplayObject.prototype._renderWebGL = function(renderSession) { // OVERWRITE; @@ -725,5 +754,3 @@ this.position.y = value; } }); - - diff --git a/src/pixi/display/DisplayObjectContainer.js b/src/pixi/display/DisplayObjectContainer.js index 93e4f5c..3bee268 100644 --- a/src/pixi/display/DisplayObjectContainer.js +++ b/src/pixi/display/DisplayObjectContainer.js @@ -2,7 +2,6 @@ * @author Mat Groves http://matgroves.com/ @Doormat23 */ - /** * A DisplayObjectContainer represents a collection of display objects. * It is the base class of all display objects that act as a container for other objects. @@ -35,8 +34,6 @@ * @property width * @type Number */ - - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', { get: function() { return this.scale.x * this.getLocalBounds().width; @@ -59,14 +56,12 @@ } }); - /** * The height of the displayObjectContainer, setting this will actually modify the scale to achieve the value set * * @property height * @type Number */ - Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', { get: function() { return this.scale.y * this.getLocalBounds().height; @@ -88,12 +83,12 @@ } }); - /** * Adds a child to the container. * * @method addChild * @param child {DisplayObject} The DisplayObject to add to the container + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChild = function(child) { @@ -106,6 +101,7 @@ * @method addChildAt * @param child {DisplayObject} The child to add * @param index {Number} The index to place the child in + * @return {DisplayObject} The child that was added. */ PIXI.DisplayObjectContainer.prototype.addChildAt = function(child, index) { @@ -131,12 +127,11 @@ }; /** - * [NYI] Swaps the depth of 2 displayObjects + * Swaps the position of 2 Display Objects within this container. * * @method swapChildren * @param child {DisplayObject} * @param child2 {DisplayObject} - * @private */ PIXI.DisplayObjectContainer.prototype.swapChildren = function(child, child2) { @@ -153,7 +148,6 @@ this.children[index1] = child2; this.children[index2] = child; - }; @@ -197,6 +191,7 @@ * * @method getChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child at the given index, if any. */ PIXI.DisplayObjectContainer.prototype.getChildAt = function(index) { @@ -213,6 +208,7 @@ * * @method removeChild * @param child {DisplayObject} The DisplayObject to remove + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChild = function(child) { @@ -223,10 +219,11 @@ }; /** - * Removes a child from the specified index position in the child list of the container. + * Removes a child from the specified index position. * * @method removeChildAt * @param index {Number} The index to get the child from + * @return {DisplayObject} The child that was removed. */ PIXI.DisplayObjectContainer.prototype.removeChildAt = function(index) { @@ -240,11 +237,11 @@ }; /** -* Removes all child instances from the child list of the container. +* Removes all children from this container that are within the begin and end indexes. * * @method removeChildren -* @param beginIndex {Number} The beginning position. Predefined value is 0. -* @param endIndex {Number} The ending position. Predefined value is children's array length. +* @param beginIndex {Number} The beginning position. Default value is 0. +* @param endIndex {Number} The ending position. Default value is size of the container. */ PIXI.DisplayObjectContainer.prototype.removeChildren = function(beginIndex, endIndex) { @@ -274,7 +271,7 @@ }; /* - * Updates the container's childrens transform for rendering + * Updates the transform on all children of this container for rendering * * @method updateTransform * @private @@ -294,10 +291,10 @@ }; /** - * Retrieves the bounds of the displayObjectContainer as a rectangle object + * Retrieves the bounds of the displayObjectContainer as a rectangle. The bounds calculation takes all visible children into consideration. * * @method getBounds - * @return {Rectangle} the rectangular bounding area + * @return {Rectangle} The rectangular bounding area */ PIXI.DisplayObjectContainer.prototype.getBounds = function(matrix) { @@ -360,6 +357,12 @@ return bounds; }; +/** + * Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration. + * + * @method getLocalBounds + * @return {Rectangle} The rectangular bounding area + */ PIXI.DisplayObjectContainer.prototype.getLocalBounds = function() { var matrixCache = this.worldTransform; @@ -379,7 +382,7 @@ }; /** - * Sets the container's stage reference, the stage this object is connected to + * Sets the containers Stage reference. This is the Stage that this object, and all of its children, is connected to. * * @method setStageReference * @param stage {Stage} the stage that the container will have as its current stage reference @@ -397,7 +400,7 @@ }; /** - * removes the current stage reference of the container + * Removes the current stage reference from the container and all of its children. * * @method removeStageReference */ diff --git a/src/pixi/display/MovieClip.js b/src/pixi/display/MovieClip.js index 70ad553..05b51b8 100644 --- a/src/pixi/display/MovieClip.js +++ b/src/pixi/display/MovieClip.js @@ -88,7 +88,6 @@ } }); - /** * Stops the MovieClip * @@ -203,4 +202,4 @@ } return new PIXI.MovieClip(textures); -}; \ No newline at end of file +}; diff --git a/src/pixi/display/Sprite.js b/src/pixi/display/Sprite.js index de17ba5..5f0b664 100644 --- a/src/pixi/display/Sprite.js +++ b/src/pixi/display/Sprite.js @@ -22,7 +22,7 @@ /** * The anchor sets the origin point of the texture. * The default is 0,0 this means the texture's origin is the top left - * Setting than anchor to 0.5,0.5 means the textures origin is centred + * Setting than anchor to 0.5,0.5 means the textures origin is centered * Setting the anchor to 1,1 would mean the textures origin points will be the bottom right corner * * @property anchor @@ -56,9 +56,8 @@ */ this._height = 0; - /** - * The tint applied to the sprite. This is a hex value + * The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect. * * @property tint * @type Number @@ -67,7 +66,7 @@ this.tint = 0xFFFFFF; /** - * The blend mode to be applied to the sprite + * The blend mode to be applied to the sprite. Set to PIXI.blendModes.NORMAL to remove any blend mode. * * @property blendMode * @type Number @@ -75,9 +74,8 @@ */ this.blendMode = PIXI.blendModes.NORMAL; - /** - * The shader that will be used to render the texture to the stage. + * The shader that will be used to render the texture to the stage. Set to null to remove a current shader. * * @property shader * @type PIXI.AbstractFilter @@ -160,12 +158,11 @@ if(this._width)this.scale.x = this._width / this.texture.frame.width; if(this._height)this.scale.y = this._height / this.texture.frame.height; - //this.updateFrame = true; }; /** -* Returns the framing rectangle of the sprite as a PIXI.Rectangle object +* Returns the bounds of the Sprite as a rectangle. The bounds calculation takes the worldTransform into account. * * @method getBounds * @param matrix {Matrix} the transformation matrix of the sprite @@ -173,7 +170,6 @@ */ PIXI.Sprite.prototype.getBounds = function(matrix) { - var width = this.texture.frame.width; var height = this.texture.frame.height; diff --git a/src/pixi/display/SpriteBatch.js b/src/pixi/display/SpriteBatch.js index dd732f1..790d696 100644 --- a/src/pixi/display/SpriteBatch.js +++ b/src/pixi/display/SpriteBatch.js @@ -34,7 +34,7 @@ }; PIXI.SpriteBatch.prototype = Object.create(PIXI.DisplayObjectContainer.prototype); -PIXI.SpriteBatch.constructor = PIXI.SpriteBatch; +PIXI.SpriteBatch.prototype.constructor = PIXI.SpriteBatch; /* * Initialises the spriteBatch @@ -58,9 +58,9 @@ */ PIXI.SpriteBatch.prototype.updateTransform = function() { - // TODO dont need to! + // TODO don't need to! PIXI.DisplayObject.prototype.updateTransform.call( this ); - // PIXI.DisplayObjectContainer.prototype.updateTransform.call( this ); + // PIXI.DisplayObjectContainer.prototype.updateTransform.call( this ); }; /** @@ -175,4 +175,3 @@ // context.restore(); }; - diff --git a/src/pixi/display/Stage.js b/src/pixi/display/Stage.js index f5ce92e..900f22f 100644 --- a/src/pixi/display/Stage.js +++ b/src/pixi/display/Stage.js @@ -26,7 +26,7 @@ * [read-only] Current transform of the object based on world (parent) factors * * @property worldTransform - * @type Mat3 + * @type Matrix * @readOnly * @private */ @@ -61,7 +61,7 @@ this.stage = this; //optimize hit detection a bit - this.stage.hitArea = new PIXI.Rectangle(0,0,100000, 100000); + this.stage.hitArea = new PIXI.Rectangle(0, 0, 100000, 100000); this.setBackgroundColor(backgroundColor); }; @@ -124,10 +124,10 @@ }; /** - * This will return the point containing global coords of the mouse. + * This will return the point containing global coordinates of the mouse. * * @method getMousePosition - * @return {Point} The point containing the coords of the global InteractionData position. + * @return {Point} A point containing the coordinates of the global InteractionData position. */ PIXI.Stage.prototype.getMousePosition = function() {