diff --git a/src/pixi/display/DisplayObject.js b/src/pixi/display/DisplayObject.js index 38e41ac..45ffa33 100644 --- a/src/pixi/display/DisplayObject.js +++ b/src/pixi/display/DisplayObject.js @@ -481,7 +481,6 @@ return this.getBounds(PIXI.identityMatrix);///PIXI.EmptyRectangle(); }; - /** * Sets the object's stage reference, the stage this object is connected to * @@ -509,22 +508,34 @@ this._generateCachedSprite(); }; +/** + * Calculates the global position of the display object + * + * @method toGlobal + * @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) { this.updateTransform(); return this.worldTransform.apply(pos); }; +/** + * Calculates the local position of the display object relative to another point + * + * @method toGlobal + * @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) { if (from) { pos = from.toGlobal(pos); } - else //toGlobal calls updateTransform, don't call it twice - { - this.updateTransform(); - } + this.updateTransform(); return this.worldTransform.applyInverse(pos); };