diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-09-22 15:03:00 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-09-22 15:03:00 +0800 |
commit | 59663cdb0bea2c79aceabd5c222ff32d99fe8afc (patch) | |
tree | f4ca3c96289cec1484f95a3a0c33bb74506282e9 | |
parent | 2abb5459a7403dcb7342a8dffe2445d76c36f4cf (diff) |
feat(utils): allow rect transition based only on left/top
-rw-r--r-- | src/utils.mjs | 4 |
1 files changed, 2 insertions, 2 deletions
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 = {}) => { | |||
37 | const { width: w1, height: h1, left: x1, top: y1 } = rect | 37 | const { width: w1, height: h1, left: x1, top: y1 } = rect |
38 | const { width: w2, height: h2, left: x2, top: y2 } = element.getBoundingClientRect() | 38 | const { width: w2, height: h2, left: x2, top: y2 } = element.getBoundingClientRect() |
39 | 39 | ||
40 | const rw = w1 / w2 | 40 | const rw = (w1 ?? w2) / w2 |
41 | const rh = h1 / h2 | 41 | const rh = (h1 ?? h2) / h2 |
42 | const dx = x1 - x2; | 42 | const dx = x1 - x2; |
43 | const dy = y1 - y2; | 43 | const dy = y1 - y2; |
44 | 44 | ||