Skip to content

Commit bc1c933

Browse files
committed
fix: the latest value was not used during position reversal
1 parent bb94258 commit bc1c933

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/hooks/useAlign.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,9 @@ export default function useAlign(
442442
nextOffsetY = tmpNextOffsetY;
443443
popupOffsetY = -popupOffsetY;
444444

445-
nextAlignInfo.points = [
446-
reversePoints(popupPoints, 0),
447-
reversePoints(targetPoints, 0),
448-
];
445+
nextAlignInfo.points = nextAlignInfo.points.map((point) =>
446+
reversePoints(splitPoints(point), 0),
447+
);
449448
} else {
450449
prevFlipRef.current.bt = false;
451450
}
@@ -488,10 +487,9 @@ export default function useAlign(
488487
nextOffsetY = tmpNextOffsetY;
489488
popupOffsetY = -popupOffsetY;
490489

491-
nextAlignInfo.points = [
492-
reversePoints(popupPoints, 0),
493-
reversePoints(targetPoints, 0),
494-
];
490+
nextAlignInfo.points = nextAlignInfo.points.map((point) =>
491+
reversePoints(splitPoints(point), 0),
492+
);
495493
} else {
496494
prevFlipRef.current.tb = false;
497495
}
@@ -541,10 +539,9 @@ export default function useAlign(
541539
nextOffsetX = tmpNextOffsetX;
542540
popupOffsetX = -popupOffsetX;
543541

544-
nextAlignInfo.points = [
545-
reversePoints(popupPoints, 1),
546-
reversePoints(targetPoints, 1),
547-
];
542+
nextAlignInfo.points = nextAlignInfo.points.map((point) =>
543+
reversePoints(splitPoints(point), 1),
544+
);
548545
} else {
549546
prevFlipRef.current.rl = false;
550547
}
@@ -587,10 +584,9 @@ export default function useAlign(
587584
nextOffsetX = tmpNextOffsetX;
588585
popupOffsetX = -popupOffsetX;
589586

590-
nextAlignInfo.points = [
591-
reversePoints(popupPoints, 1),
592-
reversePoints(targetPoints, 1),
593-
];
587+
nextAlignInfo.points = nextAlignInfo.points.map((point) =>
588+
reversePoints(splitPoints(point), 1),
589+
);
594590
} else {
595591
prevFlipRef.current.lr = false;
596592
}

0 commit comments

Comments
 (0)