Vorab-Knopf Call mit Betrag in der zweiten Zeile, Abstand zwischen Haken und Text

Wie im Client: "Call" und darunter, was ein Call jetzt kostete (hoechster
Einsatz minus der eigene, hoechstens der eigene Stack); Haken links mit
Abstand, Schrift leichter. Faelle: test_vorab_call_zeigt_den_betrag_unter_dem_text,
test_vorab_haken_steht_mit_abstand_vor_dem_text (beide vorher rot).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 20:33:30 +01:00
co-authored by Claude Opus 5.5
parent f2f3399038
commit c20ac5af58
7 changed files with 53 additions and 6 deletions
+22 -4
View File
@@ -143,6 +143,11 @@
.aktionsleiste button:hover { background-color: #26272c; border-color: #3c3e46; }
.aktionsleiste button:active { background-color: #0f0f11; box-shadow: inset 0 calc(var(--h) * .3) calc(var(--h) * .6) rgba(0, 0, 0, .6); }
.aktionsleiste .haken { color: #8e8e90; font-weight: 700; }
/* Vorab-Knopf wie im Bild: Haken links mit Abstand, Text mittig, ein Betrag darunter */
.aktionsleiste button:has(.haken) { display: flex; align-items: center; justify-content: center; gap: calc(var(--b) * 1.3);
font-weight: 500; }
.aktionsleiste .text { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.aktionsleiste .text small { font-size: inherit; font-weight: inherit; }
.aktionsleiste .an .haken { color: #3ddc84; }
.aktionsleiste .gross { width: calc(var(--b) * 12.5); height: calc(var(--h) * 6.4); }
.aktionsleiste .klein { width: calc(var(--b) * 4.6); height: calc(var(--h) * 4.6); font-size: calc(var(--h) * 2); }
@@ -380,9 +385,9 @@ const LEISTE = {
["Raise" + (z.raise ? " " + z.raise: ""), 0.93, 0.94, "gross raise", "raise"],
["33%", 0.616, 0.86, "klein", "v33"], ["50%", 0.677, 0.86, "klein", "v50"],
["75%", 0.735, 0.86, "klein", "v75"], ["Max", 0.784, 0.86, "klein", "vmax"]],
vorab: () => [["✓ Call Any", 0.79, 0.876, "gross", "callany"],
vorab: z => [["✓ Call Any", 0.79, 0.876, "gross", "callany"],
["✓ X/F", 0.66, 0.95, "gross", "xf"],
["✓ Call", 0.80, 0.95, "gross", "vcall"]],
["✓ Call" + (vorabCall(z) ? "\n" + betrag(vorabCall(z)) : ""), 0.80, 0.95, "gross", "vcall"]],
voll: () => [["Find Seat", 0.902, 0.951, "gross", "findseat"],
["Join Wait List", 0.720, 0.951, "gross", "waitlist"]],
keine: () => [],
@@ -393,6 +398,16 @@ const WERT = {TWO: "2", THREE: "3", FOUR: "4", FIVE: "5", SIX: "6", SEVEN: "7",
let zustand = null, leisteSchluessel = "", vorab = new Set();
// Was ein Call jetzt kostete (Vorab-Knopf, Bild: "Call / 77,680"): hoechster Einsatz minus der eigene,
// hoechstens der eigene Stack. ANNAHME: so rechnet der Client; im Bild ist es der All-in-Call.
function vorabCall(z) {
const zahl = v => typeof v === "number" ? v : 0;
const ich = (z.sitze || []).find(s => s.nr === z.held_sitz);
if (!ich) return 0;
const hoechster = Math.max(0, ...z.sitze.map(s => zahl(s.einsatz)));
return Math.max(0, Math.min(hoechster - zahl(ich.einsatz), zahl(ich.chips)));
}
// --- Maus ----------------------------------------------------------------------------------------
// Wo die Seite die Maus zuletzt sah (Pixel des Viewports) - nur fuer das Hover-Profil unten.
const maus = {x: null, y: null};
@@ -543,9 +558,12 @@ function leisteZeichnen() {
for (const [text, fx, fy, art, name] of knoepfe) {
const b = document.createElement("button");
if (text.startsWith("✓ ")) { // der Haken ist ein eigenes Zeichen (grau, angehakt gruen); der Text bleibt gleich
const h = document.createElement("span");
const h = document.createElement("span"), t = document.createElement("span");
h.className = "haken"; h.textContent = "✓";
b.append(h, document.createTextNode(text.slice(1)));
const [zeile, betragZeile] = text.slice(1).split("\n");
t.className = "text"; t.append(document.createTextNode(zeile));
if (betragZeile) { const s = document.createElement("small"); s.textContent = betragZeile; t.append(s); }
b.append(h, t);
} else b.textContent = text;
b.className = art; b.dataset.fx = fx; b.dataset.fy = fy;
if (vorab.has(name)) b.classList.add("an");
+4 -1
View File
@@ -13,6 +13,7 @@ der des Clients: 820x628, Titelleiste 0.0446 der Hoehe (28 px) oberhalb der Seit
python3 mock/tischbild.py
"""
import os
import re
import sys
import time
@@ -92,7 +93,9 @@ def zeilen(t, vorlage, groesse):
t.js("buyinSchliessen()")
k = messen(spiel, "#spielkreuz")[0]
auf.append(("Fensterkreuz", soll.KREUZ, "tisch-geometrie.md", _mitte(k)))
vorab = {m["text"]: m for m in messen(spiel, ".aktionsleiste button")}
# Beschriftung ohne Zeilenumbrueche und ohne den Betrag der zweiten Zeile ("Call / 77,680")
vorab = {re.sub(r" [\d,.]+M?$", "", " ".join(m["text"].split())): m
for m in messen(spiel, ".aktionsleiste button")}
for text, stelle in soll.BILD_VORAB.items():
auf.append((f"Leiste {text}", stelle, "Bild", _mitte(vorab[text])))
zug = dict(spiel, leiste="zug", call=None)
Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

After

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 250 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

+27 -1
View File
@@ -66,7 +66,8 @@ class TischLayout(unittest.TestCase):
return self.t.rahmen_von(aussen)
def nach_text(self, messung):
return {m["text"]: m for m in messung}
"""Knoepfe nach ihrer Beschriftung - ein Betrag in der zweiten Zeile ("Call / 77,680") zaehlt nicht mit."""
return {re.sub(r" [\d,.]+M?$", "", " ".join(m["text"].split())): m for m in messung}
# -- 1. zeichnen() laeuft durch ---------------------------------------------------------------
def test_zeichnen_laeuft_durch_und_jeder_punkt_hat_eine_stelle(self):
@@ -535,6 +536,31 @@ class TischLayout(unittest.TestCase):
self.assertEqual(self.t.js("document.getElementById('pot').textContent"), "203,960")
self.assertIn("1,280", self.t.js("[...document.querySelectorAll('.einsatz')].map(e => e.textContent)"))
def test_vorab_call_zeigt_den_betrag_unter_dem_text(self):
"""Bild: der Vorab-Knopf "Call" traegt in der zweiten Zeile den Betrag, den ein Call kostete -
hoechster Einsatz minus der eigene, hoechstens der eigene Stack (dort all-in: 77,680)."""
self.spiel()
knopf = "[...document.querySelectorAll('.aktionsleiste button')].find(b => b.querySelector('.text') && b.querySelector('.text').firstChild.textContent.trim() === 'Call')"
self.assertTrue(self.t.js(f"!!({knopf})"), "kein Vorab-Knopf Call mit eigenem Text")
self.assertEqual(self.t.js(f"({knopf}).querySelector('small').textContent"), "77,680")
unter = self.t.js(f"(() => {{ const b = {knopf}; const t = b.querySelector('.text').getClientRects()[0], "
f"s = b.querySelector('small').getBoundingClientRect(); return s.top >= t.top + t.height * .5; }})()")
self.assertTrue(unter, "der Betrag steht unter dem Text, nicht daneben")
# nichts zu zahlen: kein Betrag
sitze = [dict(s, einsatz=0) for s in zustand_im_spiel(self.vorlage)["sitze"]]
self.spiel(sitze=sitze)
self.assertFalse(self.t.js(f"!!(({knopf}) || {{}}).querySelector && !!({knopf}).querySelector('small')"))
def test_vorab_haken_steht_mit_abstand_vor_dem_text(self):
"""Bild: zwischen Haken und Text liegt rund eine Zeichenbreite (etwa 0.015 der Breite), nicht 0."""
self.spiel()
r = self.t.rahmen()
luecken = self.t.js("[...document.querySelectorAll('.aktionsleiste button')].filter(b => b.querySelector('.haken'))"
".map(b => b.querySelector('.text').getBoundingClientRect().left - b.querySelector('.haken').getBoundingClientRect().right)")
self.assertEqual(len(luecken), 3, luecken)
for l in luecken:
self.assertGreaterEqual(l / r["w"], 0.008, f"Abstand Haken-Text {l / r['w']:.4f}")
def test_dealerknopf_rotes_sechseck_neben_dem_platz(self):
"""Bild: roter Knopf mit weissem D neben der Platte des Gebers (zustand.geber); ohne Geber keiner."""
self.spiel(geber=None)