모든 게임이 남는 화면 전체를 쓰도록: 게임별 폭 상한 제거, 판·카드·말을 --play-w/--play-h에 맞춰 키움

- 카드 게임: 펠트가 남는 높이를 채우고 손패·가운데 더미·자리 크기가 화면에 따라 커짐
- 판 게임: 체스·바둑·오목 등은 높이를 다 쓰고, 장기·쿼리도·젬블로는 넓은 화면에서 조작판을 판 옆으로
- 섯다: 자리를 판 크기에 맞춘 타원 위에 고르게 두고, 많을 때 자리 크기를 줄여 8명에서도 겹치지 않게
- 바퀴벌레 포커 6명·야단법석 달리기 5명 선수 뽑기가 PC에서 넘치지 않게
- 휴대폰·태블릿(1100px 아래) 배치는 그대로
- layout-survey: 컴퓨터 넣기 버튼 기다림, 넘친 높이(px) 표시

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-17 16:17:15 +09:00
parent adc3b5337a
commit ca8baf5cc8
40 changed files with 1025 additions and 403 deletions

View File

@@ -127,6 +127,15 @@ const CSS = `
.oc-opps { flex-wrap: wrap; justify-content: center; overflow: visible; width: 100%; max-width: calc(var(--cols) * 184px - 4px); margin: 0 auto; }
.oc-seat { flex: 0 1 calc((100% - (var(--cols) - 1) * 8px) / var(--cols)); min-width: 0; max-width: 176px; }
}
/* PC: fill the play column. The felt takes the spare height, piles and hand cards grow with the play area, seats get bigger. */
@media (min-width: 1100px) {
.oc { max-width: none; align-self: stretch; flex: 1 1 auto; min-height: 0; gap: 12px; }
.oc-opps { max-width: calc(var(--cols) * 256px - 4px); }
.oc-seat { max-width: 248px; padding: 8px 12px; font-size: clamp(.9rem, calc(var(--play-h) / 62), 1.1rem); }
.oc-table { flex: 1 1 auto; grid-template-columns: 1fr auto auto 1fr; gap: clamp(16px, 2vw, 40px); padding: 20px 28px; font-size: clamp(1rem, calc(var(--play-h) / 62), 1.2rem); }
.oc-table > .oc-pile { grid-column: 2; }
.oc-hand { justify-content: center; }
}
@media (max-width: 719px) {
.oc-table { grid-template-columns: auto auto; padding: 10px; gap: 10px; border-width: 6px; justify-content: center; }
.oc-info { grid-column: 1 / -1; align-items: center; }
@@ -230,7 +239,7 @@ function AttackCount({ n, uno }: { n: number; uno: boolean }) {
function TableArea({ v, players, canDraw, onDraw, onDropCard, fx }: { v: OneCardView; players: Record<string, PublicUser>; canDraw: boolean; onDraw: () => void; onDropCard: (id: string) => void; fx: Fx }) {
const [over, setOver] = useState(false);
const from = fx.playFrom && fx.playFrom.discard === v.discardCount ? fx.playFrom : null;
const pw = 'clamp(64px, 9vw, 92px)';
const pw = 'clamp(64px, min(9vw, var(--play-h) * .15), 210px)';
const recent = v.recent;
const top = recent[recent.length - 1];
const drawText = v.pendingAttack > 0 ? `${v.pendingAttack}장 먹기` : '1장 먹기';
@@ -333,18 +342,26 @@ function TableArea({ v, players, canDraw, onDraw, onDropCard, fx }: { v: OneCard
// ---------------------------------------------------------------- my hand
function useWidth<T extends HTMLElement>(): [React.RefObject<T | null>, number] {
/** Element width plus the PC play-area height (--play-h on .game-main; 0 under 1100px where it is not measured). */
function useWidth<T extends HTMLElement>(): [React.RefObject<T | null>, number, number] {
const ref = useRef<T>(null);
const [w, setW] = useState(0);
const [h, setH] = useState(0);
useLayoutEffect(() => {
const el = ref.current;
if (!el) return;
setW(el.clientWidth);
const ro = new ResizeObserver(() => setW(el.clientWidth));
const main = el.closest('.game-main');
const update = () => {
setW(el.clientWidth);
setH(main && matchMedia('(min-width: 1100px)').matches ? parseFloat(getComputedStyle(main).getPropertyValue('--play-h')) || 0 : 0);
};
update();
const ro = new ResizeObserver(update);
ro.observe(el);
if (main) ro.observe(main);
return () => ro.disconnect();
}, []);
return [ref, w];
return [ref, w, h];
}
interface PickState {
@@ -359,7 +376,7 @@ function MyHand({ v, act, pending, players, arrived }: { v: OneCardView; act: (a
const [hints, setHints] = useState(true);
const [pick, setPick] = useState<PickState | null>(null);
const [note, setNote] = useState('');
const [ref, width] = useWidth<HTMLDivElement>();
const [ref, width, playH] = useWidth<HTMLDivElement>();
const hand = sortHand(my.hand, sortBy);
const legal = new Set(my.legalCardIds);
const turnKey = `${v.turnNo}-${v.phase}`;
@@ -417,7 +434,7 @@ function MyHand({ v, act, pending, players, arrived }: { v: OneCardView; act: (a
// Layout: one overlapping row on wide screens, wrapped rows on phones (cards ≥ 48 × 68).
const n = hand.length;
const phone = width > 0 && width < 600;
const cw = phone ? 54 : 78;
const cw = phone ? 54 : Math.round(Math.min(156, Math.max(78, playH * 0.12)));
let ov = 6;
if (!phone && n > 1) ov = Math.max(-cw * 0.6, Math.min(6, (width - cw * n) / (n - 1)));
if (phone) ov = n > 12 ? -14 : 4;