mirror of
https://github.com/photonstorm/phaser
synced 2024-11-16 01:38:23 +00:00
Merge pull request #5839 from natureofcode/fix/issue-5828
Fix #5828, improve GameObject#disableInteractive() and InputPlugin#disable()
This commit is contained in:
commit
385800ec2f
2 changed files with 39 additions and 5 deletions
|
@ -504,10 +504,7 @@ var GameObject = new Class({
|
|||
*/
|
||||
disableInteractive: function ()
|
||||
{
|
||||
if (this.input)
|
||||
{
|
||||
this.input.enabled = false;
|
||||
}
|
||||
this.scene.sys.input.disable(this);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
|
@ -838,7 +838,44 @@ var InputPlugin = new Class({
|
|||
*/
|
||||
disable: function (gameObject)
|
||||
{
|
||||
gameObject.input.enabled = false;
|
||||
var input = gameObject.input;
|
||||
|
||||
if (!input)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
input.enabled = false;
|
||||
input.dragState = 0;
|
||||
|
||||
// Clear from _temp, _drag and _over
|
||||
var index = this._temp.indexOf(gameObject);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
this._temp.splice(index, 1);
|
||||
}
|
||||
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
index = this._drag[i].indexOf(gameObject);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
this._drag[i].splice(index, 1);
|
||||
}
|
||||
|
||||
index = this._over[i].indexOf(gameObject);
|
||||
|
||||
if (index > -1)
|
||||
{
|
||||
this._over[i].splice(index, 1);
|
||||
|
||||
this.manager.resetCursor(input);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue