From 997e7a0f89712066fd80706dc1a5ca4d4b6bbc4f Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Fri, 11 Jun 2021 10:17:38 +0200 Subject: [PATCH] Buttons work now on mobile devices --- public/js/Button.js | 4 ++-- public/js/game.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/js/Button.js b/public/js/Button.js index 306e6bd..72182d1 100644 --- a/public/js/Button.js +++ b/public/js/Button.js @@ -9,7 +9,7 @@ function Button(default_color, hover_color, select_color, width, height, x, y, t this.text = text; this.status = status; this.button_is_answer = button_is_answer; - this.click = click; + this.pointerdown = click; this.selected = false; let _this = this; @@ -55,7 +55,7 @@ function Button(default_color, hover_color, select_color, width, height, x, y, t this.graphics.interactive = true; this.graphics.buttonMode = true; this.graphics.defaultCursor = 'pointer'; - this.graphics.on('click', function () { + this.graphics.on('pointerdown', function () { if (_this.button_is_answer) { if (_this.selected === true) { _this.unSelectButton(); diff --git a/public/js/game.js b/public/js/game.js index dfc5076..894d500 100644 --- a/public/js/game.js +++ b/public/js/game.js @@ -126,7 +126,7 @@ function start_game() { dice.interactive = true; dice.buttonMode = true; dice.defaultCursor = 'pointer'; - dice.on('click', function () { + dice.on('pointerdown', function () { if (!diced) { socket.emit('roll dice'); } @@ -178,7 +178,7 @@ function generate_card_stack(sprite, x, y, onclick) { sprite.interactive = true; sprite.buttonMode = true; sprite.defaultCursor = 'pointer'; - sprite.on('click', onclick); + sprite.on('pointerdown', onclick); return sprite; }