Merge pull request #3627 from simeydotme/3555-fix-flip-scaling

Fix #3555 ; scale elements in FLIP animations
pull/3932/head
Rich Harris 5 years ago committed by GitHub
commit 05cf649f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,9 +19,11 @@ interface FlipParams {
export function flip(node: Element, animation: { from: DOMRect; to: DOMRect }, params: FlipParams): AnimationConfig {
const style = getComputedStyle(node);
const transform = style.transform === 'none' ? '' : style.transform;
const scaleX = animation.from.width / node.clientWidth;
const scaleY = animation.from.height / node.clientHeight;
const dx = animation.from.left - animation.to.left;
const dy = animation.from.top - animation.to.top;
const dx = (animation.from.left - animation.to.left) / scaleX;
const dy = (animation.from.top - animation.to.top) / scaleY;
const d = Math.sqrt(dx * dx + dy * dy);

Loading…
Cancel
Save