From 516aab9de3d6ad5b52da75666ce9f6531c913be6 Mon Sep 17 00:00:00 2001 From: Hsieh Chin Fan Date: Sun, 22 Sep 2024 17:51:57 +0800 Subject: feat(utils): return empty Animation, not null for DOMRect --- 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 eeedb81..41b772e 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|null} https://developer.mozilla.org/en-US/docs/Web/API/Animation + * @returns {Animation} 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 null; + return new Animation() } const transform1 = `translate(0, 0) scale(1, 1)`; -- cgit v1.2.3-70-g09d2