Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
natureofcode committed Sep 17, 2021
1 parent e23d50e commit 89ff862
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/gameobjects/GameObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
},
Expand Down
38 changes: 37 additions & 1 deletion src/input/InputPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,43 @@ var InputPlugin = new Class({
*/
disable: function (gameObject)
{
gameObject.input.enabled = false;
var input = gameObject.input;

if (!input)
{
return this;
}

input.enabled = false;

// 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;
},

/**
Expand Down

0 comments on commit 89ff862

Please sign in to comment.