모든 게임이 남는 화면 전체를 쓰도록: 게임별 폭 상한 제거, 판·카드·말을 --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:
@@ -154,6 +154,15 @@ const CSS = `
|
||||
.un-opps { flex-wrap: wrap; justify-content: center; overflow: visible; width: 100%; max-width: calc(var(--cols) * 184px - 4px); margin: 0 auto; }
|
||||
.un-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) {
|
||||
.un { max-width: none; align-self: stretch; flex: 1 1 auto; min-height: 0; gap: 12px; }
|
||||
.un-opps { max-width: calc(var(--cols) * 256px - 4px); }
|
||||
.un-seat { max-width: 248px; padding: 8px 12px; font-size: clamp(.9rem, calc(var(--play-h) / 62), 1.1rem); }
|
||||
.un-table { flex: 1 1 auto; grid-template-columns: 1fr auto auto 1fr; gap: clamp(18px, 2vw, 40px); padding: 20px 28px; font-size: clamp(1rem, calc(var(--play-h) / 62), 1.2rem); }
|
||||
.un-table > .un-pile { grid-column: 2; }
|
||||
.un-hand { justify-content: center; }
|
||||
}
|
||||
@media (max-width: 719px) {
|
||||
.un-table { grid-template-columns: auto auto; padding: 12px 10px 10px; gap: 14px; border-width: 6px; justify-content: center; }
|
||||
.un-info { grid-column: 1 / -1; align-items: center; }
|
||||
@@ -216,7 +225,7 @@ function SeatChip({ s, v, players, me, deadline, next }: { s: SeatView; v: UnoVi
|
||||
|
||||
function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: UnoView; players: Record<string, PublicUser>; canDraw: boolean; onDraw: () => void; onDropCard: (id: string) => void }) {
|
||||
const [over, setOver] = useState(false);
|
||||
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.my?.drawCount ?? 1}장 뽑기`;
|
||||
@@ -286,18 +295,26 @@ function TableArea({ v, players, canDraw, onDraw, onDropCard }: { v: UnoView; pl
|
||||
|
||||
// ---------------------------------------------------------------- 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];
|
||||
}
|
||||
|
||||
function ColorSheet({ title, onPick, onClose }: { title: string; onPick: (c: Color) => void; onClose: () => void }) {
|
||||
@@ -326,7 +343,7 @@ function MyHand({ v, act, pending, players }: { v: UnoView; act: (a: unknown) =>
|
||||
const [hints, setHints] = useState(true);
|
||||
const [pick, setPick] = useState<string | 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.playable);
|
||||
const bluff = new Set(my.bluff);
|
||||
@@ -379,7 +396,7 @@ function MyHand({ v, act, pending, players }: { v: UnoView; act: (a: unknown) =>
|
||||
// One overlapping row on wide screens, wrapped rows on phones (cards ≥ 54 × 76).
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user