From 59663cdb0bea2c79aceabd5c222ff32d99fe8afc Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 22 Sep 2024 15:03:00 +0800 Subject: feat(utils): allow rect transition based only on left/top --- src/utils.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/utils.mjs') diff --git a/src/utils.mjs b/src/utils.mjs index 3eb57bb..eeedb81 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -37,8 +37,8 @@ export const animateRectTransition = (element, rect, options = {}) => { const { width: w1, height: h1, left: x1, top: y1 } = rect const { width: w2, height: h2, left: x2, top: y2 } = element.getBoundingClientRect() - const rw = w1 / w2 - const rh = h1 / h2 + const rw = (w1 ?? w2) / w2 + const rh = (h1 ?? h2) / h2 const dx = x1 - x2; const dy = y1 - y2; -- cgit v1.2.3-70-g09d2