Tweaked interaction manager to handle mouse leave events better

This commit is contained in:
Mat Groves 2014-02-04 08:52:25 +00:00
parent a1091473ec
commit c2cf3f264c
2 changed files with 9 additions and 2 deletions

View file

@ -61,6 +61,8 @@ PIXI.InteractionManager = function(stage)
this.last = 0; this.last = 0;
this.currentCursorStyle = 'inherit'; this.currentCursorStyle = 'inherit';
this.mouseOut = false;
}; };
// constructor // constructor
@ -386,7 +388,6 @@ PIXI.InteractionManager.prototype.onMouseOut = function()
for (var i = 0; i < length; i++) for (var i = 0; i < length; i++)
{ {
var item = this.interactiveItems[i]; var item = this.interactiveItems[i];
if(item.__isOver) if(item.__isOver)
{ {
this.mouse.target = item; this.mouse.target = item;
@ -394,6 +395,12 @@ PIXI.InteractionManager.prototype.onMouseOut = function()
item.__isOver = false; item.__isOver = false;
} }
} }
this.mouseOut = true;
// move the mouse to an impossible position
this.mouse.global.x = -10000;
this.mouse.global.y = -10000;
}; };
/** /**

View file

@ -61,7 +61,7 @@ PIXI.JsonLoader.prototype.constructor = PIXI.JsonLoader;
* @method load * @method load
*/ */
PIXI.JsonLoader.prototype.load = function () { PIXI.JsonLoader.prototype.load = function () {
this.ajaxRequest = new PIXI.AjaxRequest(); this.ajaxRequest = new PIXI.AjaxRequest(this.crossorigin);
var scope = this; var scope = this;
this.ajaxRequest.onreadystatechange = function () { this.ajaxRequest.onreadystatechange = function () {
scope.onJSONLoaded(); scope.onJSONLoaded();