Ziel-Karte am Handy: schlanke Zeile, weicht Ton-Knopf aus, quer klein

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-27 22:06:55 +01:00
co-authored by Claude Opus 5.5
parent 47bae6181c
commit 444292757c
49 changed files with 860 additions and 758 deletions
+15 -7
View File
@@ -272,20 +272,28 @@
einer 390 Punkte breiten Leinwand halb so groß wie das Bild. Die
kleinste Schrift (.8em) liegt bei 14,4 px Grundmaß bei 11,5 px. */
.sziel[data-klein="ja"] .szk {
width: 15em; display: grid; grid-template-columns: 2.6em 1fr; gap: .6em;
padding: .5em .6em; align-items: center; border-radius: .9em;
width: 16em; display: grid; grid-template-columns: 2.3em 1fr; gap: .6em;
padding: .35em .7em .35em .4em; align-items: center; border-radius: .9em;
}
.sziel[data-klein="ja"] .szk__bild { aspect-ratio: auto; width: 2.6em; height: 2.6em; border-radius: .5em; }
.sziel[data-klein="ja"] .szk__bild { aspect-ratio: auto; width: 2.3em; height: 2.3em; border-radius: .5em; }
.sziel[data-klein="ja"] .szk__bild::after,
.sziel[data-klein="ja"] .szk__kat,
.sziel[data-klein="ja"] .szk__label,
.sziel[data-klein="ja"] .szk__text,
.sziel[data-klein="ja"] .szk__marke,
.sziel[data-klein="ja"] .szk__stempel { display: none; }
.sziel[data-klein="ja"] .szk__inhalt { margin: 0; padding: 0; min-width: 0; }
.sziel[data-klein="ja"] .szk__titel { font-size: 1em; margin: 0; }
.sziel[data-klein="ja"] .szk__balken { margin-top: .3em; height: .45em; }
.sziel[data-klein="ja"] .szk__zahlen { font-size: .8em; margin-top: .2em; }
/* ZWEI ZEILEN STATT DREI (27.10.2026): Titel und Prozent nebeneinander,
der Balken darunter. Am Handy steht „Ton einschalten" mitten im Bild,
und zwischen ihm und dem Schild „AUF SENDUNG" sind auf einem 390er
Handy gut 70 Punkte frei -- die alte Zeile war 63 hoch und passte mit
Abstand nicht hinein. */
.sziel[data-klein="ja"] .szk__inhalt {
margin: 0; padding: 0; min-width: 0;
display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .5em; align-items: baseline;
}
.sziel[data-klein="ja"] .szk__titel { font-size: 1em; margin: 0; grid-column: 1; grid-row: 1; }
.sziel[data-klein="ja"] .szk__balken { margin-top: .3em; height: .45em; grid-column: 1 / -1; grid-row: 2; }
.sziel[data-klein="ja"] .szk__zahlen { font-size: .8em; margin-top: 0; grid-column: 2; grid-row: 1; }
.sziel[data-klein="ja"] .szk__zahlen b { display: none; }
.sziel[data-klein="ja"] .szk__plus { font-size: .8em; top: .2em; right: .4em; }
+60 -28
View File
@@ -262,7 +262,11 @@
breit; bei der Mindestgröße (16 px, damit die kleinste Schrift
11,5 px bleibt) wären das 320 Punkte -- auf einer 390er
Leinwand mehr als drei Viertel des Bildes. */
const klein = w > 0 && w < 560;
/* UND UNTER 420 PUNKTEN HOEHE: Am Handy quer ist die Leinwand 844
breit, aber nur gut 300 hoch -- die volle Karte bedeckte dort
30 % des Spiels (gemessen 27.10.2026). */
const hoch = kasten.clientHeight || 0;
const klein = (w > 0 && w < 560) || (hoch > 0 && hoch < 420);
wurzel.dataset.klein = klein ? 'ja' : 'nein';
const basis = klein ? 14.4 : Math.max(16, Math.min(20, w * 0.0185));
wurzel.style.fontSize = `${(basis * (klein ? Math.max(1, g) : g)).toFixed(2)}px`;
@@ -297,48 +301,72 @@
Quelle weiß niemand, was die Szene sonst noch zeigt. */
function platzieren() {
if (!opt.hindernisse) return;
const oben = (wurzel.dataset.platz || 'or')[0] === 'o';
if (wurzel.dataset.an !== 'ja') return;
/* Die Wahl der Regie steht in `data-wunsch`; `data-platz` ist die
Ecke, in der die Karte gerade WIRKLICH steht. Jeder Durchgang
rechnet vom Wunsch aus -- so springt nichts hin und her. */
const wunsch = wurzel.dataset.wunsch || wurzel.dataset.platz || 'or';
const block = (wurzel.offsetParent || kasten).getBoundingClientRect();
/* Die SICHTBARE Karte zählt, nicht das Rasterfeld -- das ist im
Wechsel so breit wie die breiteste aller Karten. */
const wr = (wurzel.querySelector('.szk[data-sichtbar="ja"]') || wurzel).getBoundingClientRect();
if (block.width < 1 || wr.width < 1) return;
const rand = (parseFloat(wurzel.style.fontSize) || 16) * 1.1;
const rechts = (wurzel.dataset.platz || 'or')[1] === 'r';
const luft = 6;
const rechts = wunsch[1] === 'r';
const x0 = rechts ? block.right - rand - wr.width : block.left + rand;
const x1 = x0 + wr.width;
const mitte = block.top + block.height / 2;
let bedarf = rand;
const H = block.height;
const h = wr.height;
/* Was in der Spalte der Karte liegt, in Koordinaten der Leinwand. */
const im = [];
for (const sel of opt.hindernisse) {
for (const h of document.querySelectorAll(sel)) {
if (wurzel.contains(h) || h.contains(wurzel)) continue;
const r = h.getBoundingClientRect();
for (const el of document.querySelectorAll(sel)) {
if (wurzel.contains(el) || el.contains(wurzel)) continue;
const r = el.getBoundingClientRect();
if (r.width < 2 || r.height < 2) continue;
const c = getComputedStyle(h);
const c = getComputedStyle(el);
if (c.visibility === 'hidden' || Number(c.opacity) < 0.05) continue;
if (r.right < x0 - 8 || r.left > x1 + 8) continue;
/* ZU WELCHER HÄLFTE ein Hindernis gehört, sagt seine MITTE --
nicht seine Kante. Am Handy ragt „Ton einschalten" knapp über
die Bildmitte; nach der Kante zählte es oben mit, die Karte
passte rechnerisch nicht mehr und blieb unter dem Schild
liegen (gemessen am 390er Handy). */
const hMitte = (r.top + r.bottom) / 2;
if (oben) {
if (hMitte > mitte) continue;
bedarf = Math.max(bedarf, r.bottom - block.top + 8);
} else {
if (hMitte < mitte) continue;
bedarf = Math.max(bedarf, block.bottom - r.top + 8);
}
im.push({ oben: r.top - block.top, unten: r.bottom - block.top });
}
}
const passt = bedarf + wr.height <= block.height - rand;
const wert = `${Math.round(passt ? bedarf : rand)}px`;
wurzel.dataset.gedraengt = passt ? 'nein' : 'ja';
const name = oben ? '--sz-oben' : '--sz-unten';
/* ==== ZWEI GRENZEN, NICHT EINE (27.10.2026, am Handy gemessen) ===
Bisher schob nur, was in der EIGENEN Hälfte lag. Am Handy steht
„Ton einschalten" mitten im Bild -- die Karte rutschte unter dem
Schild hervor und genau auf diesen Knopf. Jetzt gilt: Was in der
eigenen Hälfte liegt, schiebt den Anfang; was in der anderen
liegt, begrenzt das Ende. ZU WELCHER HÄLFTE ein Hindernis gehört,
sagt weiter seine MITTE, nicht seine Kante.
`start` ist der Abstand vom eigenen Rand (oben oder unten). */
const versuch = (oben) => {
let start = rand;
let grenze = H - rand;
for (const o of im) {
const eigene = oben ? (o.oben + o.unten) / 2 <= H / 2 : (o.oben + o.unten) / 2 >= H / 2;
if (eigene) start = Math.max(start, oben ? o.unten + luft : H - o.oben + luft);
else grenze = Math.min(grenze, oben ? o.oben - luft : H - o.unten - luft);
}
return { oben, start, passt: start + h <= grenze };
};
/* Passt sie in ihrer Hälfte nicht, darf sie in die andere -- in
derselben Ecke links oder rechts. Passt sie nirgends, bleibt sie
im Wunsch, aber UNTER dem, was oben liegt (das Schild steht
höher als sie und deckte sonst ihren Titel), und sagt es. */
const wunschOben = wunsch[0] === 'o';
let v = versuch(wunschOben);
if (!v.passt) {
const anders = versuch(!wunschOben);
if (anders.passt) v = anders;
}
const platz = (v.oben ? 'o' : 'u') + wunsch[1];
if (wurzel.dataset.platz !== platz) wurzel.dataset.platz = platz;
wurzel.dataset.gewichen = v.oben === wunschOben ? 'nein' : 'ja';
wurzel.dataset.gedraengt = v.passt ? 'nein' : 'ja';
const wert = `${Math.round(Math.max(rand, Math.min(v.start, H - rand - h)))}px`;
const name = v.oben ? '--sz-oben' : '--sz-unten';
if (wurzel.style.getPropertyValue(name) !== wert) wurzel.style.setProperty(name, wert);
wurzel.style.removeProperty(oben ? '--sz-unten' : '--sz-oben');
wurzel.style.removeProperty(v.oben ? '--sz-unten' : '--sz-oben');
}
/* ==== DIE VORSCHAU WIRD EINGEPASST, NICHT KLEINER GERECHNET ======
Die Regie-Spalte ist schmaler als die Karte (320 Punkte). Kleiner
@@ -402,7 +430,11 @@
const vorherAnzeige = stand?.anzeige;
const vorherWechsel = stand?.wechsel_s;
stand = neu;
wurzel.dataset.platz = ['ol', 'or', 'ul', 'ur'].includes(neu.platz) ? neu.platz : 'or';
const wunsch = ['ol', 'or', 'ul', 'ur'].includes(neu.platz) ? neu.platz : 'or';
if (wurzel.dataset.wunsch !== wunsch || !wurzel.dataset.platz) {
wurzel.dataset.wunsch = wunsch;
wurzel.dataset.platz = wunsch;
}
masse();
const ziele = Array.isArray(neu.ziele) ? neu.ziele : [];