Browse Source

KERNEL-11877 feat: direction:bottom和direction:top空间不够时的调整逻辑

es6
zsmj 2 years ago
parent
commit
c486970d50
  1. 8
      src/core/platform/web/dom.js

8
src/core/platform/web/dom.js

@ -384,11 +384,11 @@
if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) { if (BI.DOM.isTopSpaceEnough(combo, popup, -1 * comboBounds.height + extraHeight)) {
top = comboOffset.top + comboBounds.height - containerBounds.top - popupBounds.height; top = comboOffset.top + comboBounds.height - containerBounds.top - popupBounds.height;
} else if (needAdaptHeight) { } else if (needAdaptHeight) {
top = 0; top = 0 - containerBounds.top;
adaptHeight = comboOffset.top + comboBounds.height - extraHeight; adaptHeight = comboBounds.top + comboBounds.height - extraHeight;
} else if (BI.DOM.isBottomSpaceEnough(combo, popup, -1 * 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"; dir = "bottom";
} else { } else {
top = 0; top = 0;
@ -396,7 +396,7 @@
adaptHeight = windowBounds.height - extraHeight; adaptHeight = windowBounds.height - extraHeight;
} }
} }
if (top < 0) { if (top + containerBounds.top < 0) {
top = 0; top = 0;
} }
return adaptHeight ? { return adaptHeight ? {

Loading…
Cancel
Save