Added resetCursor boolean to disableInteractive and removeInteractive methods

This commit is contained in:
Richard Davey 2024-08-07 18:36:02 +01:00
parent 0bffd9e087
commit 5b972ae38a

View file

@ -502,12 +502,16 @@ var GameObject = new Class({
*
* @method Phaser.GameObjects.GameObject#disableInteractive
* @since 3.7.0
*
* @param {boolean} [resetCursor=false] - Should the currently active Input cursor, if any, be reset to the default cursor?
*
* @return {this} This GameObject.
*/
disableInteractive: function ()
disableInteractive: function (resetCursor)
{
this.scene.sys.input.disable(this);
if (resetCursor === undefined) { resetCursor = false; }
this.scene.sys.input.disable(this, resetCursor);
return this;
},
@ -534,13 +538,22 @@ var GameObject = new Class({
*
* @method Phaser.GameObjects.GameObject#removeInteractive
* @since 3.7.0
*
* @param {boolean} [resetCursor=false] - Should the currently active Input cursor, if any, be reset to the default cursor?
*
* @return {this} This GameObject.
*/
removeInteractive: function ()
removeInteractive: function (resetCursor)
{
if (resetCursor === undefined) { resetCursor = false; }
this.scene.sys.input.clear(this);
if (resetCursor)
{
this.scene.sys.input.resetCursor();
}
this.input = undefined;
return this;