diff --git a/src/pixi/InteractionData.js b/src/pixi/InteractionData.js index b0d8a6a..326007c 100644 --- a/src/pixi/InteractionData.js +++ b/src/pixi/InteractionData.js @@ -41,12 +41,13 @@ * @method getLocalPosition * @param displayObject {DisplayObject} The DisplayObject that you would like the local coords off * @param [point] {Point} A Point object in which to store the value, optional (otherwise will create a new point) + * param [globalPos] {Point} A Point object containing your custom global coords, optional (otherwise will use the current global coords) * @return {Point} A point containing the coordinates of the InteractionData position relative to the DisplayObject */ -PIXI.InteractionData.prototype.getLocalPosition = function(displayObject, point) +PIXI.InteractionData.prototype.getLocalPosition = function(displayObject, point, globalPos) { var worldTransform = displayObject.worldTransform; - var global = this.global; + var global = globalPos ? globalPos : this.global; // do a cheeky transform to get the mouse coords; var a00 = worldTransform.a, a01 = worldTransform.c, a02 = worldTransform.tx, diff --git a/src/pixi/InteractionData.js b/src/pixi/InteractionData.js index b0d8a6a..326007c 100644 --- a/src/pixi/InteractionData.js +++ b/src/pixi/InteractionData.js @@ -41,12 +41,13 @@ * @method getLocalPosition * @param displayObject {DisplayObject} The DisplayObject that you would like the local coords off * @param [point] {Point} A Point object in which to store the value, optional (otherwise will create a new point) + * param [globalPos] {Point} A Point object containing your custom global coords, optional (otherwise will use the current global coords) * @return {Point} A point containing the coordinates of the InteractionData position relative to the DisplayObject */ -PIXI.InteractionData.prototype.getLocalPosition = function(displayObject, point) +PIXI.InteractionData.prototype.getLocalPosition = function(displayObject, point, globalPos) { var worldTransform = displayObject.worldTransform; - var global = this.global; + var global = globalPos ? globalPos : this.global; // do a cheeky transform to get the mouse coords; var a00 = worldTransform.a, a01 = worldTransform.c, a02 = worldTransform.tx, diff --git a/src/pixi/InteractionManager.js b/src/pixi/InteractionManager.js index 646d0a8..6084696 100644 --- a/src/pixi/InteractionManager.js +++ b/src/pixi/InteractionManager.js @@ -708,8 +708,8 @@ touchData.originalEvent = event; // update the touch position - touchData.global.x = ( (touchEvent.clientX - rect.left) * (this.target.width / rect.width) ) / this.resolution; - touchData.global.y = ( (touchEvent.clientY - rect.top) * (this.target.height / rect.height) ) / this.resolution; + touchEvent.globalX = touchData.global.x = ( (touchEvent.clientX - rect.left) * (this.target.width / rect.width) ) / this.resolution; + touchEvent.globalY = touchData.global.y = ( (touchEvent.clientY - rect.top) * (this.target.height / rect.height) ) / this.resolution; if (navigator.isCocoonJS && !rect.left && !rect.top && !event.target.style.width && !event.target.style.height) { //Support for CocoonJS fullscreen scale modes