mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Now possible to clear interactive objects.
This commit is contained in:
parent
d2f08f0818
commit
e20d4b1156
4 changed files with 25 additions and 2 deletions
|
@ -84,6 +84,11 @@ var GameObject = new Class({
|
|||
{
|
||||
this.parent.remove(this);
|
||||
|
||||
if (this.input)
|
||||
{
|
||||
this.scene.sys.inputManager.clear(this);
|
||||
}
|
||||
|
||||
this.scene = undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ var SceneInputManager = new Class({
|
|||
|
||||
boot: require('./components/Boot'),
|
||||
begin: require('./components/Begin'),
|
||||
clear: require('./components/Clear'),
|
||||
update: require('./components/Update'),
|
||||
hitTestPointer: require('./components/HitTestPointer'),
|
||||
disable: require('./components/Disable'),
|
||||
|
|
|
@ -25,8 +25,9 @@ var Begin = function ()
|
|||
{
|
||||
current.splice(index, 1);
|
||||
|
||||
// TODO: Tidy up all of the Interactive Objects references, callbacks, shapes, etc
|
||||
gameObject.input = null;
|
||||
// TODO: Clear from _draggable, _drag and _over too
|
||||
|
||||
this.clear(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
16
v3/src/input/local/components/Clear.js
Normal file
16
v3/src/input/local/components/Clear.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
var Clear = function (gameObject)
|
||||
{
|
||||
var input = gameObject.input;
|
||||
|
||||
input.gameObject = undefined;
|
||||
input.target = undefined;
|
||||
input.hitArea = undefined;
|
||||
input.hitAreaCallback = undefined;
|
||||
input.callbackContext = undefined;
|
||||
|
||||
gameObject.input = null;
|
||||
|
||||
return gameObject;
|
||||
};
|
||||
|
||||
module.exports = Clear;
|
Loading…
Reference in a new issue