From bc1c9339a9954d1fdab7198f88e0bfdb1842e513 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=82=9C=E6=9E=97?= <2910041955@qq.com> Date: Thu, 17 Apr 2025 17:20:01 +0800 Subject: [PATCH] fix: the latest value was not used during position reversal --- src/hooks/useAlign.ts | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/hooks/useAlign.ts b/src/hooks/useAlign.ts index f5e5194..3c587af 100644 --- a/src/hooks/useAlign.ts +++ b/src/hooks/useAlign.ts @@ -442,10 +442,9 @@ export default function useAlign( nextOffsetY = tmpNextOffsetY; popupOffsetY = -popupOffsetY; - nextAlignInfo.points = [ - reversePoints(popupPoints, 0), - reversePoints(targetPoints, 0), - ]; + nextAlignInfo.points = nextAlignInfo.points.map((point) => + reversePoints(splitPoints(point), 0), + ); } else { prevFlipRef.current.bt = false; } @@ -488,10 +487,9 @@ export default function useAlign( nextOffsetY = tmpNextOffsetY; popupOffsetY = -popupOffsetY; - nextAlignInfo.points = [ - reversePoints(popupPoints, 0), - reversePoints(targetPoints, 0), - ]; + nextAlignInfo.points = nextAlignInfo.points.map((point) => + reversePoints(splitPoints(point), 0), + ); } else { prevFlipRef.current.tb = false; } @@ -541,10 +539,9 @@ export default function useAlign( nextOffsetX = tmpNextOffsetX; popupOffsetX = -popupOffsetX; - nextAlignInfo.points = [ - reversePoints(popupPoints, 1), - reversePoints(targetPoints, 1), - ]; + nextAlignInfo.points = nextAlignInfo.points.map((point) => + reversePoints(splitPoints(point), 1), + ); } else { prevFlipRef.current.rl = false; } @@ -587,10 +584,9 @@ export default function useAlign( nextOffsetX = tmpNextOffsetX; popupOffsetX = -popupOffsetX; - nextAlignInfo.points = [ - reversePoints(popupPoints, 1), - reversePoints(targetPoints, 1), - ]; + nextAlignInfo.points = nextAlignInfo.points.map((point) => + reversePoints(splitPoints(point), 1), + ); } else { prevFlipRef.current.lr = false; }