From 25117de9d3b55461b3fe0f2cdc37356ffcc12b0c Mon Sep 17 00:00:00 2001 From: zsmj Date: Fri, 23 Dec 2022 10:39:02 +0800 Subject: [PATCH] =?UTF-8?q?BI-119128=20fix:=20=E3=80=90=E8=87=AA=E9=80=82?= =?UTF-8?q?=E5=BA=94=E8=BF=AD=E4=BB=A3=E5=8F=91=E6=95=A3=E3=80=91=E5=B0=8F?= =?UTF-8?q?=E5=B1=8F=E7=BC=96=E8=BE=91=EF=BC=8C=E9=AB=98=E5=BA=A6=E9=80=82?= =?UTF-8?q?=E5=BA=94+=E8=87=AA=E5=AE=9A=E4=B9=89=EF=BC=881366*449=EF=BC=89?= =?UTF-8?q?=EF=BC=8C=E7=9B=B4=E6=8E=A5=E9=A2=84=E8=A7=88=EF=BC=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=8E=A7=E4=BB=B6=E4=B8=8B=E6=8B=89=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=81=8F=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上下空间都不够的时候场景。 另外高度自适应fixed元素导致滚动问题还需探索一下 --- src/core/platform/web/dom.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/core/platform/web/dom.js b/src/core/platform/web/dom.js index ef1989c8a..945aa359a 100644 --- a/src/core/platform/web/dom.js +++ b/src/core/platform/web/dom.js @@ -416,27 +416,28 @@ }; }, - getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight) { + getBottomAdaptPosition: function (combo, popup, extraHeight, needAdaptHeight, positionRelativeElement) { var comboBounds = combo.element[0].getBoundingClientRect(), popupBounds = popup.element[0].getBoundingClientRect(), - windowBounds = BI.Widget._renderEngine.createElement("body").bounds(); + viewportBounds = document.documentElement.getBoundingClientRect(), + positionRelativeElementRect = positionRelativeElement.getBoundingClientRect(); if (BI.DOM.isBottomSpaceEnough(combo, popup, extraHeight)) { - return BI.DOM.getBottomPosition(combo, popup, extraHeight); + return BI.DOM.getBottomPosition(combo, popup, extraHeight, positionRelativeElement); } if (needAdaptHeight) { return { - top: comboBounds.top + comboBounds.height + extraHeight, - adaptHeight: windowBounds.height - comboBounds.top - comboBounds.height - extraHeight + top: comboBounds.top + comboBounds.height + extraHeight - positionRelativeElementRect.top, + adaptHeight: viewportBounds.height - comboBounds.top - comboBounds.height - extraHeight }; } - if (popupBounds.height + extraHeight > windowBounds.height) { + if (popupBounds.height + extraHeight > viewportBounds.height) { return { - top: extraHeight, - adaptHeight: windowBounds.height - extraHeight + top: extraHeight - positionRelativeElementRect.top, + adaptHeight: viewportBounds.height - extraHeight }; } return { - top: windowBounds.height - popupBounds.height - extraHeight + top: viewportBounds.height - popupBounds.height - extraHeight - positionRelativeElementRect.top }; },