From: Geoffrey Allott Date: Sat, 17 Jun 2023 18:14:08 +0000 (+0100) Subject: display scores on outside of table for cribbage X-Git-Url: https://git.pointlesshacks.com/?a=commitdiff_plain;h=83053d2aece6cf83cd812af595582ada3f64ef34;p=pokerwave.git display scores on outside of table for cribbage --- diff --git a/site/modules/cribbage.js b/site/modules/cribbage.js index 1f14fe9..c3ce18f 100644 --- a/site/modules/cribbage.js +++ b/site/modules/cribbage.js @@ -53,12 +53,12 @@ export class Cribbage extends GameWithChat { const seat = this.seats.get(username); const angle = this.player_angle(seat); const x = 240 - 180 * Math.sin(angle); - const y = 250 + 120 * Math.cos(angle) + 50 * Math.sign(Math.cos(angle)); + const y = 240 + 120 * Math.cos(angle) + 60 * (Math.sign(Math.cos(angle)) || 1); icon.setAttribute("x", x); icon.setAttribute("y", y); score.childNodes[0].nodeValue = this.scores.get(username); - score.setAttribute("x", 240 - 120 * Math.sin(angle)); - score.setAttribute("y", 250 + 70 * Math.cos(angle)); + score.setAttribute("x", x); + score.setAttribute("y", y + 20); active.classList.toggle("active", active_player === username); active.setAttribute("cx", x - 10); active.setAttribute("cy", y - 5);