From c8aeff4cea05aa7341933ec38cc2f461b57e0afb Mon Sep 17 00:00:00 2001 From: yetone Date: Sat, 26 Sep 2026 01:13:06 +0800 Subject: [PATCH] =?UTF-8?q?gui:=20a=20picker=20opened=20upward=20sits=20on?= =?UTF-8?q?=20its=20button=20=E2=80=94=20with=20no=20room=20below,=20it=20?= =?UTF-8?q?was=20placed=20the=20most=20it=20could=20be=20tall=20(420px=20f?= =?UTF-8?q?or=20a=20model=20picker)=20above=20the=20button,=20so=20a=20sho?= =?UTF-8?q?rt=20list,=20like=20ZCode's=20two,=20hung=20a=20few=20rows=20up?= =?UTF-8?q?=20over=20another=20agent's=20row;=20opened=20upward,=20its=20b?= =?UTF-8?q?ottom=20edge=20is=20held=20to=20the=20button=20now?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/assets/app.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js index 24380c52..48c7cf1a 100644 --- a/internal/gui/assets/app.js +++ b/internal/gui/assets/app.js @@ -782,9 +782,17 @@ function placePop(anchor, w, h) { let x = Math.min(r.left, innerWidth - w - pad); let y = r.bottom + 5; pop.classList.remove("up"); - if (y + h > innerHeight - pad && r.top - 5 - h >= pad) { y = r.top - 5 - h; pop.classList.add("up"); } - else if (y + h > innerHeight - pad) y = Math.max(pad, innerHeight - pad - h); pop.style.left = Math.max(pad, x) + "px"; + // h is the most it can be: opened upward, its bottom edge is held to the + // button, so a short list sits on the button rather than h above it + if (y + h > innerHeight - pad && r.top - 5 - h >= pad) { + pop.classList.add("up"); + pop.style.top = "auto"; + pop.style.bottom = innerHeight - r.top + 5 + "px"; + return; + } + if (y + h > innerHeight - pad) y = Math.max(pad, innerHeight - pad - h); + pop.style.bottom = "auto"; pop.style.top = y + "px"; }