From c486970d507ae7796af2c2804a7e18d8d0f6494b Mon Sep 17 00:00:00 2001 From: zsmj Date: Sat, 10 Dec 2022 14:20:58 +0800 Subject: [PATCH] =?UTF-8?q?KERNEL-11877=20feat:=20direction:bottom?= =?UTF-8?q?=E5=92=8Cdirection:top=E7=A9=BA=E9=97=B4=E4=B8=8D=E5=A4=9F?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E8=B0=83=E6=95=B4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/platform/web/dom.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index d45ccc3b2..66e970b56 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -384,11 +384,11 @@ if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { top = comboOffset.top + comboBounds.height - containerBounds.top - popupBounds.height; } else if (needAdaptHeight) { - top = 0; - adaptHeight = comboOffset.top + comboBounds.height - extraHeight; + top = 0 - containerBounds.top; + adaptHeight = comboBounds.top + comboBounds.height - extraHeight; } else if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { // 上方空间不足且不允许调整高度的情况下,优先使用下对齐 - top = comboOffset.top + extraHeight; + top = comboOffset.top - containerBounds.top + extraHeight; dir = "bottom"; } else { top = 0; @@ -396,7 +396,7 @@ adaptHeight = windowBounds.height - extraHeight; } } - if (top < 0) { + if (top + containerBounds.top < 0) { top = 0; } return adaptHeight ? {