Skip to content

Commit 4e8ab3d

Browse files
committed
MouseManager.target can now be defined as either a string or by passing an HTMLElement directly. Fix phaserjs#4353
1 parent 6d79e11 commit 4e8ab3d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/input/mouse/MouseManager.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ var MouseManager = new Class({
6464
this.enabled = false;
6565

6666
/**
67-
* The Touch Event target, as defined in the Game Config.
67+
* The Mouse target, as defined in the Game Config.
6868
* Typically the canvas to which the game is rendering, but can be any interactive DOM element.
6969
*
7070
* @name Phaser.Input.Mouse.MouseManager#target
@@ -204,6 +204,10 @@ var MouseManager = new Class({
204204
{
205205
this.target = this.manager.game.canvas;
206206
}
207+
else if (typeof this.target === 'string')
208+
{
209+
this.target = document.getElementById(this.target);
210+
}
207211

208212
if (config.disableContextMenu)
209213
{

0 commit comments

Comments
 (0)