From 9d579e00faefe50047c869f494cd2c1ba4d2780d Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sat, 21 Sep 2024 10:51:33 +0800 Subject: fix: trivial case for DOMRect animation --- 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 f30178a..8162aa6 100644 --- a/src/utils.mjs +++ b/src/utils.mjs @@ -29,7 +29,7 @@ export const onRemove = (element, callback) => { * @param {Object} options * @param {Boolean} options.resume If true, transition starts from rect to DOMRect of element * @param {Number} options.duration Duration of animation in milliseconds - * @returns {Animation} https://developer.mozilla.org/en-US/docs/Web/API/Animation + * @returns {Animation|null} https://developer.mozilla.org/en-US/docs/Web/API/Animation */ export const animateRectTransition = (element, rect, options = {}) => { if (!element.parentElement) throw new Error("The node must already be attached"); @@ -43,7 +43,7 @@ export const animateRectTransition = (element, rect, options = {}) => { const dy = y1 - y2; if (dx === 0 && dy === 0 || rw === Infinity || rh === Infinity) { - return; + return null; } const transform1 = `translate(0, 0) scale(1, 1)`; -- cgit v1.2.3-70-g09d2