Skip to content

Commit

Permalink
fix: onDone not being called with force: true (references #111) (#129)
Browse files Browse the repository at this point in the history
Change applies in case there is no need to scroll.
  • Loading branch information
rchl authored and rigor789 committed Sep 10, 2019
1 parent e3cab59 commit 6ff03b2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/scrollTo.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,19 @@ export const scroller = () => {
}
}

if (onStart) onStart(element);

if (!diffY && !diffX) {
onDone(element);
return;
}

if (typeof easing === "string") {
easing = easings[easing] || easings["ease"];
}

easingFn = BezierEasing.apply(BezierEasing, easing);

if (!diffY && !diffX) return;
if (onStart) onStart(element);

_.on(container, abortEvents, abortFn, { passive: true });

window.requestAnimationFrame(step);
Expand Down

0 comments on commit 6ff03b2

Please sign in to comment.