From 9bbf75f54c152aed9d40954b8a61481c60033de6 Mon Sep 17 00:00:00 2001 From: Mischa Untaga <99098079+MischaU8@users.noreply.github.com> Date: Mon, 4 Dec 2023 14:52:40 +0100 Subject: use mousedown events --- play.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'play.js') diff --git a/play.js b/play.js index 9d25f31..41149c2 100644 --- a/play.js +++ b/play.js @@ -358,8 +358,7 @@ function create_campaigner(color, i) { className: `piece ${color}`, my_campaigner: i, }) - // TODO use onmousedown and figure out why it didn't work on mobile - e.addEventListener("click", on_click_campaigner) + e.addEventListener("mousedown", on_click_campaigner) return e } @@ -374,14 +373,13 @@ function build_user_interface() { REGIONS_LAYOUT.push(LAYOUT[r.replaceAll(' & ', '')]) } - // TODO use onmousedown and figure out why it didn't work on mobile - ui.congress_box.addEventListener("click", on_click_congress) + ui.congress_box.addEventListener("mousedown", on_click_congress) for (let c = 1; c <= 6; ++c) { elt = ui.congress[c] = create("div", { className: "piece congress", style: `left:${15 + (c-1) * 42}px;top:-6px;`, }) - elt.addEventListener("click", on_click_congress) + elt.addEventListener("mousedown", on_click_congress) } for (let i = 0; i < 12; ++i) { @@ -401,6 +399,7 @@ function build_user_interface() { className: `card card_${c}`, my_card: c, }) + // TODO use onmousedown and figure out why it didn't work on mobile elt.addEventListener("click", on_click_card) } -- cgit v1.2.3