Skip to content
This repository
Browse code

* Fix error in calculating page index sent with scrollability-page ev…

…ents
  • Loading branch information...
commit 86177c0ce202cd03d156c17f83787777b99b6f66 1 parent 417486c
Joe Hewitt authored

Showing 1 changed file with 6 additions and 7 deletions. Show diff stats Hide diff stats

  1. 13  scrollability.js
13  scrollability.js
@@ -77,10 +77,10 @@ var directions = {
77 77
 exports.directions = directions;
78 78
 
79 79
 exports.flashIndicators = function() {
80  
-    var scrollables = document.querySelectorAll('.scrollable.vertical');
81  
-    for (var i = 0; i < scrollables.length; ++i) {
82  
-        exports.scrollTo(scrollables[i], 0, 0, 20, true);
83  
-    }            
  80
+    // var scrollables = document.querySelectorAll('.scrollable.vertical');
  81
+    // for (var i = 0; i < scrollables.length; ++i) {
  82
+    //     exports.scrollTo(scrollables[i], 0, 0, 20, true);
  83
+    // }            
84 84
 }
85 85
 
86 86
 function onLoad() {
@@ -198,7 +198,6 @@ function wrapAnimator(animator, startX, startY, startTime) {
198 198
     var timeStep = 0;
199 199
     var stopped = 0;
200 200
     var tracked = [];
201  
-    var pageSpacing;
202 201
     var offset = node.scrollableOffset||0;
203 202
 
204 203
     if (!animator.mute) {
@@ -406,7 +405,7 @@ function wrapAnimator(animator, startX, startY, startTime) {
406 405
 
407 406
                         // XXXjoe Only difference between this and code below is -viewport. Merge 'em!
408 407
                         var totalSpacing = min % viewport;
409  
-                        var page = -Math.round((position+viewport-totalSpacing)/viewport);
  408
+                        var page = -Math.round((position+viewport-totalSpacing)/(viewport+pageSpacing));
410 409
                         dispatch("scrollability-page", animator.node, {page: page});
411 410
                     }
412 411
                 } else {
@@ -415,7 +414,7 @@ function wrapAnimator(animator, startX, startY, startTime) {
415 414
                         min -= viewport+pageSpacing;
416 415
 
417 416
                         var totalSpacing = min % viewport;
418  
-                        var page = -Math.round((position-viewport-totalSpacing)/viewport);
  417
+                        var page = -Math.round((position-viewport-totalSpacing)/(viewport+pageSpacing));
419 418
                         dispatch("scrollability-page", animator.node, {page: page});
420 419
                     }
421 420
                 }

0 notes on commit 86177c0

Please sign in to comment.
Something went wrong with that request. Please try again.