Skip to content

Commit

Permalink
fix: compensate offset when trigget is shift
Browse files Browse the repository at this point in the history
  • Loading branch information
bbb169 committed Jul 6, 2023
1 parent 60583ce commit a8c1696
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useAlign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ export default function useAlign(
if (typeof numShiftY === 'number') {
// Top
if (nextPopupY < visibleRegionArea.top) {
nextOffsetY -= nextPopupY - visibleRegionArea.top;
nextOffsetY -= nextPopupY - visibleRegionArea.top + popupOffsetY;

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

// Bottom
if (nextPopupBottom > visibleRegionArea.bottom) {
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom;
nextOffsetY -= nextPopupBottom - visibleRegionArea.bottom - popupOffsetY;

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

0 comments on commit a8c1696

Please sign in to comment.