@@ -29,7 +29,7 @@ Phaser.Sprite = function (game, x, y, key, frame) {
2929 PIXI . Sprite . call ( this ) ;
3030 }
3131
32- // this.events = new Phaser.Components .Events(this);
32+ this . events = new Phaser . Events ( this ) ;
3333
3434 /**
3535 * This manages animations of the sprite. You can modify animations through it. (see AnimationManager)
@@ -102,6 +102,9 @@ Phaser.Sprite = function (game, x, y, key, frame) {
102102 // Transform cache
103103 a00 : 1 , a01 : 0 , a02 : x , a10 : 0 , a11 : 1 , a12 : y , id : 1 ,
104104
105+ // Input specific transform cache
106+ i01 : 0 , i10 : 0 , idi : 1 ,
107+
105108 // Bounds check
106109 left : null , right : null , top : null , bottom : null ,
107110
@@ -188,6 +191,7 @@ Phaser.Sprite.prototype.update = function() {
188191 {
189192 this . _cache . a00 = this . worldTransform [ 0 ] ; // scaleX a
190193 this . _cache . a01 = this . worldTransform [ 1 ] ; // skewY c
194+ this . _cache . i01 = this . worldTransform [ 1 ] ; // skewY c
191195 this . _cache . scaleX = Math . sqrt ( ( this . _cache . a00 * this . _cache . a00 ) + ( this . _cache . a01 * this . _cache . a01 ) ) ; // round this off a bit?
192196 this . _cache . a01 *= - 1 ;
193197 this . _cache . dirty = true ;
@@ -197,6 +201,7 @@ Phaser.Sprite.prototype.update = function() {
197201 if ( this . worldTransform [ 3 ] != this . _cache . a10 || this . worldTransform [ 4 ] != this . _cache . a11 )
198202 {
199203 this . _cache . a10 = this . worldTransform [ 3 ] ; // skewX b
204+ this . _cache . i10 = this . worldTransform [ 3 ] ; // skewX b
200205 this . _cache . a11 = this . worldTransform [ 4 ] ; // scaleY d
201206 this . _cache . scaleY = Math . sqrt ( ( this . _cache . a10 * this . _cache . a10 ) + ( this . _cache . a11 * this . _cache . a11 ) ) ; // round this off a bit?
202207 this . _cache . a10 *= - 1 ;
@@ -227,6 +232,7 @@ Phaser.Sprite.prototype.update = function() {
227232 this . _cache . halfHeight = Math . floor ( this . _cache . height / 2 ) ;
228233
229234 this . _cache . id = 1 / ( this . _cache . a00 * this . _cache . a11 + this . _cache . a01 * - this . _cache . a10 ) ;
235+ this . _cache . idi = 1 / ( this . _cache . a00 * this . _cache . a11 + this . _cache . i01 * - this . _cache . i10 ) ;
230236
231237 this . updateBounds ( ) ;
232238 }
@@ -262,11 +268,6 @@ Phaser.Sprite.prototype.update = function() {
262268
263269 this . body . update ( ) ;
264270
265- if ( this . input . enabled )
266- {
267- this . input . update ( ) ;
268- }
269-
270271}
271272
272273Phaser . Sprite . prototype . postUpdate = function ( ) {
@@ -309,6 +310,15 @@ Phaser.Sprite.prototype.getLocalPosition = function(p, x, y) {
309310
310311}
311312
313+ Phaser . Sprite . prototype . getLocalUnmodifiedPosition = function ( p , x , y ) {
314+
315+ p . x = this . _cache . a11 * this . _cache . idi * x + - this . _cache . i01 * this . _cache . idi * y + ( this . _cache . a12 * this . _cache . i01 - this . _cache . a02 * this . _cache . a11 ) * this . _cache . idi ;
316+ 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 ;
317+
318+ return p ;
319+
320+ }
321+
312322Phaser . Sprite . prototype . getBounds = function ( rect ) {
313323
314324 rect = rect || new Phaser . Rectangle ;
0 commit comments