From 546d09dd82c33aeee689686199d169eb9d9a2169 Mon Sep 17 00:00:00 2001 From: Simon Goellner Date: Wed, 9 Feb 2022 15:57:51 +0800 Subject: [PATCH] Update src/runtime/animate/index.ts incorporate the suggested change from @conduitry Co-authored-by: Conduitry --- src/runtime/animate/index.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/runtime/animate/index.ts b/src/runtime/animate/index.ts index 3502063307..3b4fd2f03c 100644 --- a/src/runtime/animate/index.ts +++ b/src/runtime/animate/index.ts @@ -21,12 +21,8 @@ export function flip(node: Element, { from, to }: { from: DOMRect; to: DOMRect } const transform = style.transform === 'none' ? '' : style.transform; const [ox, oy] = style.transformOrigin.split(' ').map(parseFloat); - const scale = { - x: to.width / node.clientWidth, - y: to.height / node.clientHeight - }; - const dx = ((from.left / scale.x) + (from.width / scale.x) * ox / (to.width / scale.x)) - ((to.left / scale.x) + ox); - const dy = ((from.top / scale.y) + (from.height / scale.y) * oy / (to.height / scale.y)) - ((to.top / scale.y) + oy); + const dx = ((from.left - to.left) * node.clientWidth + from.width * ox) / to.width - ox; + const dy = ((from.top - to.top) * node.clientHeight + from.height * oy) / to.height - oy; const { delay = 0,