for (const [username, cards] of this.hands) {
const seat = this.seats.get(username);
const angle = this.player_angle(seat);
- const offset = cards.length * 10;
+ const sep = username === this.username ? 60 : 20;
+ const offset = (cards.length - 3/2) * sep / 2;
let x = 227.5 + offset - 180 * Math.sin(angle);
- const y = 210 + 120 * Math.cos(angle);
+ const y = username === this.username ? 450 : 210 + 120 * Math.cos(angle);
+ const width = username === this.username ? 90 : 45;
+ const height = username === this.username ? 140 : 70;
for (const {card, image} of cards) {
image.classList.toggle("my-card", username === this.username);
image.setAttribute("x", x);
image.setAttribute("y", y);
- x -= 20;
+ image.setAttribute("width", width);
+ image.setAttribute("height", height);
+ x -= sep;
}
}
for (const [username, cards] of this.played) {
for (const [username, cards] of this.hands) {
const seat = this.seats.get(username);
const angle = this.player_angle(seat);
- const offset = cards.length * 10;
+ const sep = username === this.username ? 60 : 20;
+ const offset = (cards.length - 3/2) * sep / 2;
let x = 227.5 + offset - 180 * Math.sin(angle);
- const y = 210 + 120 * Math.cos(angle);
+ const y = username === this.username ? 450 : 210 + 120 * Math.cos(angle);
+ const width = username === this.username ? 90 : 45;
+ const height = username === this.username ? 140 : 70;
for (const {card, image} of cards) {
image.classList.toggle("my-card", username === this.username);
image.setAttribute("x", x);
image.setAttribute("y", y);
- x -= 20;
+ image.setAttribute("width", width);
+ image.setAttribute("height", height);
+ x -= sep;
}
}
let x = 257.5;