diff --git a/examples/buttons/button scale.js b/examples/buttons/button scale.js index 022c2c91..8ab6715b 100644 --- a/examples/buttons/button scale.js +++ b/examples/buttons/button scale.js @@ -56,15 +56,13 @@ function create() { // Scaled and Rotated button button6 = game.add.button(570, 200, 'button', changeSky, this, 2, 1, 0); // anchor 0.5 - // button6 = game.add.button(470, 100, 'button', changeSky, this, 2, 1, 0); // anchor 0 button6.name = 'sky6'; button6.angle = 32; button6.scale.setTo(2, 2); button6.anchor.setTo(0.5, 0.5); - - // game.world.setBounds(0, 0, 2000, 2000); // works regardless of world angle, parent angle or camera position + // game.world.setBounds(0, 0, 2000, 2000); // game.world.angle = 10; // game.camera.x = 300; @@ -87,6 +85,7 @@ function render () { // game.debug.renderWorldTransformInfo(button1, 32, 132); // game.debug.renderText('sx: ' + button3.scale.x + ' sy: ' + button3.scale.y + ' w: ' + button3.width + ' cw: ' + button3._cache.width, 32, 20); - game.debug.renderPoint(button6.input._tempPoint); + // game.debug.renderPoint(button2.input._tempPoint); + // game.debug.renderPoint(button6.input._tempPoint); } diff --git a/src/gameobjects/Sprite.js b/src/gameobjects/Sprite.js index e4c12e3c..3b261715 100644 --- a/src/gameobjects/Sprite.js +++ b/src/gameobjects/Sprite.js @@ -524,9 +524,6 @@ Phaser.Sprite.prototype.updateBounds = function() { */ Phaser.Sprite.prototype.getLocalPosition = function(p, x, y, sx, sy) { - // p.x = ((this._cache.a11 * this._cache.id * x + -this._cache.a01 * this._cache.id * y + (this._cache.a12 * this._cache.a01 - this._cache.a02 * this._cache.a11) * this._cache.id) * this.scale.x) + this._cache.a02; - // p.y = ((this._cache.a00 * this._cache.id * y + -this._cache.a10 * this._cache.id * x + (-this._cache.a12 * this._cache.a00 + this._cache.a02 * this._cache.a10) * this._cache.id) * this.scale.y) + this._cache.a12; - p.x = ((this._cache.a11 * this._cache.id * x + -this._cache.a01 * this._cache.id * y + (this._cache.a12 * this._cache.a01 - this._cache.a02 * this._cache.a11) * this._cache.id) * sx) + this._cache.a02; p.y = ((this._cache.a00 * this._cache.id * y + -this._cache.a10 * this._cache.id * x + (-this._cache.a12 * this._cache.a00 + this._cache.a02 * this._cache.a10) * this._cache.id) * sy) + this._cache.a12; @@ -549,8 +546,8 @@ Phaser.Sprite.prototype.getLocalUnmodifiedPosition = function(p, x, y) { p.y = this._cache.a00 * this._cache.idi * y + -this._cache.i10 * this._cache.idi * x + (-this._cache.a12 * this._cache.a00 + this._cache.a02 * this._cache.i10) * this._cache.idi; // apply anchor - p.x += (this.anchor.x * this.width); - p.y += (this.anchor.y * this.height); + p.x += (this.anchor.x * this._cache.width); + p.y += (this.anchor.y * this._cache.height); return p;