Skip to content

Commit 688579d

Browse files
authored
fix: compensate offset when trigget is shift (#410)
1 parent e408af5 commit 688579d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/hooks/useAlign.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ export default function useAlign(
598598
if (typeof numShiftY === 'number') {
599599
// Top
600600
if (nextPopupY < visibleRegionArea.top) {
601-
nextOffsetY -= nextPopupY - visibleRegionArea.top;
601+
nextOffsetY -= nextPopupY - visibleRegionArea.top + popupOffsetY;
602602

603603
if (targetRect.y + targetHeight < visibleRegionArea.top + numShiftY) {
604604
nextOffsetY +=
@@ -608,7 +608,7 @@ export default function useAlign(
608608

609609
// Bottom
610610
if (nextPopupBottom > visibleRegionArea.bottom) {
611-
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom;
611+
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;
612612

613613
if (targetRect.y > visibleRegionArea.bottom - numShiftY) {
614614
nextOffsetY += targetRect.y - visibleRegionArea.bottom + numShiftY;

0 commit comments

Comments
 (0)