mirror of
https://github.com/photonstorm/phaser
synced 2024-11-21 20:23:19 +00:00
InputPlugin.setCursor
is a new method that will immediately set the CSS cursor to the given Interactive Objects cursor. Previously, this was hidden behind a private method in the Input Manager.
This commit is contained in:
parent
934ba71810
commit
6102492c14
1 changed files with 21 additions and 0 deletions
|
@ -538,6 +538,27 @@ var InputPlugin = new Class({
|
|||
return (this.manager && this.manager.enabled && this.enabled && this.scene.sys.canInput());
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets a custom cursor on the parent canvas element of the game, based on the `cursor`
|
||||
* setting of the given Interactive Object (i.e. a Sprite).
|
||||
*
|
||||
* See the CSS property `cursor` for more information on MDN:
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/CSS/cursor
|
||||
*
|
||||
* @method Phaser.Input.InputPlugin#setCursor
|
||||
* @since 3.85.0
|
||||
*
|
||||
* @param {Phaser.Types.Input.InteractiveObject} interactiveObject - The Interactive Object that will set the cursor on the canvas.
|
||||
*/
|
||||
setCursor: function (interactiveObject)
|
||||
{
|
||||
if (this.manager)
|
||||
{
|
||||
this.manager.setCursor(interactiveObject);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Forces the Input Manager to clear the custom or hand cursor, regardless of the
|
||||
* interactive state of any Game Objects.
|
||||
|
|
Loading…
Reference in a new issue