Buttons work now on mobile devices

This commit is contained in:
Administrator 2021-06-11 10:17:38 +02:00
parent 0680930f78
commit 997e7a0f89
2 changed files with 4 additions and 4 deletions

View File

@ -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();

View File

@ -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;
}