|
5 | 5 | */ |
6 | 6 |
|
7 | 7 | /** |
8 | | -* Phaser.Mouse is responsible for handling all aspects of mouse interaction with the browser. |
| 8 | +* The Mouse class is responsible for handling all aspects of mouse interaction with the browser. |
| 9 | +* |
9 | 10 | * It captures and processes mouse events that happen on the game canvas object. It also adds a single `mouseup` listener to `window` which |
10 | 11 | * is used to capture the mouse being released when not over the game. |
11 | 12 | * |
@@ -72,10 +73,11 @@ Phaser.Mouse = function (game) { |
72 | 73 | this.wheelDelta = 0; |
73 | 74 |
|
74 | 75 | /** |
75 | | - * @property {boolean} disabled - You can disable all Input by setting disabled = true. While set all new input related events will be ignored. |
| 76 | + * Mouse input will only be processed if enabled. |
| 77 | + * @member {boolean} |
76 | 78 | * @default |
77 | 79 | */ |
78 | | - this.disabled = false; |
| 80 | + this.enabled = true; |
79 | 81 |
|
80 | 82 | /** |
81 | 83 | * @property {boolean} locked - If the mouse has been Pointer Locked successfully this will be set to true. |
@@ -261,7 +263,7 @@ Phaser.Mouse.prototype = { |
261 | 263 | this.mouseDownCallback.call(this.callbackContext, event); |
262 | 264 | } |
263 | 265 |
|
264 | | - if (this.game.input.disabled || this.disabled) |
| 266 | + if (!this.game.input.enabled || !this.enabled) |
265 | 267 | { |
266 | 268 | return; |
267 | 269 | } |
@@ -291,7 +293,7 @@ Phaser.Mouse.prototype = { |
291 | 293 | this.mouseMoveCallback.call(this.callbackContext, event); |
292 | 294 | } |
293 | 295 |
|
294 | | - if (this.game.input.disabled || this.disabled) |
| 296 | + if (!this.game.input.enabled || !this.enabled) |
295 | 297 | { |
296 | 298 | return; |
297 | 299 | } |
@@ -323,7 +325,7 @@ Phaser.Mouse.prototype = { |
323 | 325 | this.mouseUpCallback.call(this.callbackContext, event); |
324 | 326 | } |
325 | 327 |
|
326 | | - if (this.game.input.disabled || this.disabled) |
| 328 | + if (!this.game.input.enabled || !this.enabled) |
327 | 329 | { |
328 | 330 | return; |
329 | 331 | } |
@@ -380,7 +382,7 @@ Phaser.Mouse.prototype = { |
380 | 382 | this.mouseOutCallback.call(this.callbackContext, event); |
381 | 383 | } |
382 | 384 |
|
383 | | - if (this.game.input.disabled || this.disabled) |
| 385 | + if (!this.game.input.enabled || !this.enabled) |
384 | 386 | { |
385 | 387 | return; |
386 | 388 | } |
@@ -441,7 +443,7 @@ Phaser.Mouse.prototype = { |
441 | 443 | this.mouseOverCallback.call(this.callbackContext, event); |
442 | 444 | } |
443 | 445 |
|
444 | | - if (this.game.input.disabled || this.disabled) |
| 446 | + if (!this.game.input.enabled || !this.enabled) |
445 | 447 | { |
446 | 448 | return; |
447 | 449 | } |
@@ -543,3 +545,20 @@ Phaser.Mouse.prototype = { |
543 | 545 | }; |
544 | 546 |
|
545 | 547 | Phaser.Mouse.prototype.constructor = Phaser.Mouse; |
| 548 | + |
| 549 | +/** |
| 550 | +* If disabled all Mouse input will be ignored. |
| 551 | +* @member {boolean} |
| 552 | +* @default false |
| 553 | +* @deprecated Use {@link Phaser.Mouse#enabled} instead |
| 554 | +*/ |
| 555 | +Object.defineProperty(Phaser.Mouse.prototype, "disabled", { |
| 556 | + |
| 557 | + get: function () { |
| 558 | + return !this.enabled; |
| 559 | + }, |
| 560 | + set: function (value) { |
| 561 | + this.enabled = !value; |
| 562 | + } |
| 563 | + |
| 564 | +}); |
0 commit comments