From e8bac6c8c7b8f40fc95279f7997fbb60e5cf4815 Mon Sep 17 00:00:00 2001 From: wKLV Date: Mon, 4 Nov 2013 00:16:36 +0100 Subject: [PATCH] Check type uses the static values --- src/input/Mouse.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/input/Mouse.js b/src/input/Mouse.js index 6abbd983..2ad0683d 100644 --- a/src/input/Mouse.js +++ b/src/input/Mouse.js @@ -63,6 +63,11 @@ Phaser.Mouse = function (game) { }; +/** +* @constant +* @type {number} +*/ +Phaser.Mouse.NO_BUTTON = -1; /** * @constant * @type {number} @@ -81,6 +86,7 @@ Phaser.Mouse.MIDDLE_BUTTON = 1; */ Phaser.Mouse.RIGHT_BUTTON = 2; + Phaser.Mouse.prototype = { /** @@ -124,7 +130,9 @@ Phaser.Mouse.prototype = { event.preventDefault(); - this.mouseTypeDown = event.which - 1; + if (event.which === 1) this.mouseTypeDown = Phaser.Mouse.LEFT_BUTTON; + else if (event.which === 2) this.mouseTypeDown = Phaser.Mouse.MIDDLE_BUTON; + else if (event.which === 3) this.mouseTypeDown = Phaser.Mouse.RIGHT_BUTTON; if (this.mouseDownCallback) { @@ -176,7 +184,7 @@ Phaser.Mouse.prototype = { event.preventDefault(); - this.mouseTypeDown = -1; + this.mouseTypeDown = Phaser.Mouse.NO_BUTTON; if (this.mouseUpCallback) {