remove animation before measuring

pull/10798/head
Rich Harris 2 years ago
parent 38cc2a63a8
commit 88d1287c54

@ -94,12 +94,12 @@ export function animation(element, get_fn, get_params) {
from = this.element.getBoundingClientRect();
},
apply() {
animation?.abort();
to = this.element.getBoundingClientRect();
const options = get_fn()(this.element, { from, to }, get_params?.());
animation?.abort();
if (
from.left !== to.left ||
from.right !== to.right ||
@ -107,6 +107,7 @@ export function animation(element, get_fn, get_params) {
from.bottom !== to.bottom
) {
animation = animate(this.element, options, undefined, 1, () => {
animation?.abort();
animation = undefined;
});
}

Loading…
Cancel
Save