Permalink
Browse files

* Don't dispatch events during scrollTo animation

  • Loading branch information...
1 parent 4722906 commit 69b4aa2a288893f70642663d8a2bf53548467ff4 @joehewitt committed Sep 15, 2011
Showing with 10 additions and 9 deletions.
  1. +10 −9 scrollability.js
View
@@ -3,12 +3,8 @@
"style scrollability/scrollbar.css"
// function D() {
-// if (console.log.apply) {
-// console.log.apply(console, arguments);
-// } else {
-// var args = []; args.push.apply(args, arguments);
-// console.log(args.join(' '));
-// }
+// var args = []; args.push.apply(args, arguments);
+// console.log(args.join(' '));
// }
// *************************************************************************************************
@@ -91,6 +87,7 @@ exports.scrollTo = function(element, x, y, animationTime) {
var animator = createAnimatorForElement(element);
if (animator) {
+ animator.mute = true;
animator = wrapAnimator(animator);
touchAnimators = [animator];
touchMoved = true;
@@ -249,8 +246,10 @@ function wrapAnimator(animator, startX, startY, startTime) {
absMin += pageSpacing;
}
- if (!dispatch("scrollability-start", animator.node)) {
- return null;
+ if (!animator.mute) {
+ if (!dispatch("scrollability-start", animator.node)) {
+ return null;
+ }
}
if (scrollbar) {
@@ -432,7 +431,9 @@ function wrapAnimator(animator, startX, startY, startTime) {
scrollbar.style.opacity = '0';
scrollbar.style.webkitTransition = 'opacity 0.33s linear';
}
- dispatch("scrollability-end", animator.node);
+ if (!animator.mute) {
+ dispatch("scrollability-end", animator.node);
+ }
}
animator.sync = sync;

0 comments on commit 69b4aa2

Please sign in to comment.