Tweaked getLocalPosition
Also cahced css cursor reference in js
This commit is contained in:
parent
958afe142a
commit
854ccf54fa
3 changed files with 28 additions and 8 deletions
|
@ -3082,8 +3082,8 @@ PIXI.InteractionData.prototype.getLocalPosition = function(displayObject)
|
|||
var global = this.global;
|
||||
|
||||
// do a cheeky transform to get the mouse coords;
|
||||
var a00 = worldTransform[0], a01 = worldTransform[1], a02 = worldTransform[2],
|
||||
a10 = worldTransform[3], a11 = worldTransform[4], a12 = worldTransform[5],
|
||||
var a00 = worldTransform.a, a01 = worldTransform.b, a02 = worldTransform.tx,
|
||||
a10 = worldTransform.c, a11 = worldTransform.d, a12 = worldTransform.ty,
|
||||
id = 1 / (a00 * a11 + a01 * -a10);
|
||||
// set the mouse coords...
|
||||
return new PIXI.Point(a11 * id * global.x + -a01 * id * global.y + (a12 * a01 - a02 * a11) * id,
|
||||
|
@ -3153,6 +3153,8 @@ PIXI.InteractionManager = function(stage)
|
|||
this.onTouchEnd = this.onTouchEnd.bind(this);
|
||||
this.onTouchMove = this.onTouchMove.bind(this);
|
||||
this.last = 0;
|
||||
|
||||
this.currentCursorStyle = "inherit";
|
||||
};
|
||||
|
||||
// constructor
|
||||
|
@ -3327,8 +3329,9 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
// loop through interactive objects!
|
||||
var length = this.interactiveItems.length;
|
||||
|
||||
this.interactionDOMElement.style.cursor = 'inherit';
|
||||
|
||||
|
||||
var cursor = 'inherit'
|
||||
var over = false;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
|
@ -3350,7 +3353,7 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
// looks like there was a hit!
|
||||
if(item.__hit && !over)
|
||||
{
|
||||
if(item.buttonMode) this.interactionDOMElement.style.cursor = item.defaultCursor;
|
||||
if(item.buttonMode) cursor = item.defaultCursor;
|
||||
|
||||
if(!item.interactiveChildren)over = true;
|
||||
|
||||
|
@ -3379,6 +3382,13 @@ PIXI.InteractionManager.prototype.update = function()
|
|||
// }
|
||||
// --->
|
||||
}
|
||||
|
||||
if( this.currentCursorStyle != cursor )
|
||||
{
|
||||
this.currentCursorStyle = cursor;
|
||||
this.interactionDOMElement.style.cursor = cursor;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue