증강 윷놀이: 이의있음! 재선택에서는 혼돈 모드 두 번째 후보에도 이의있음!이 안 나오게, 증강 팝업이 위아래 공간이 모자라도 화면 안에 들어오게
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -114,8 +114,14 @@ function AugPopCard({ el, id, state, popId }: PopInfo & { el: HTMLElement; popId
|
||||
const r = el.getBoundingClientRect();
|
||||
const p = ref.current!.getBoundingClientRect();
|
||||
const gap = 8;
|
||||
const vh = window.innerHeight;
|
||||
// below the chip if it fits, else above if it fits, else on the roomier side; then kept inside the screen
|
||||
let top = r.bottom + gap;
|
||||
if (top + p.height > window.innerHeight - gap && r.top - gap - p.height >= gap) top = r.top - gap - p.height;
|
||||
if (top + p.height > vh - gap) {
|
||||
const above = r.top - gap - p.height;
|
||||
if (above >= gap || r.top > vh - r.bottom) top = above;
|
||||
}
|
||||
top = Math.max(gap, Math.min(top, vh - gap - p.height));
|
||||
const left = Math.min(Math.max(gap, r.left + r.width / 2 - p.width / 2), window.innerWidth - gap - p.width);
|
||||
setPos({ left, top });
|
||||
}, [el, id, stateKey]);
|
||||
|
||||
Reference in New Issue
Block a user