Skip to content
This repository was archived by the owner on Jun 9, 2022. It is now read-only.

Commit 4a0fc60

Browse files
committed
Revert 56bfe03 (bubbling up scroll) but try to allow the same thing using scrollResponseBoundary values
1 parent 56bfe03 commit 4a0fc60

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ftscroller",
33
"description": "FTScroller is a cross-browser Javascript/CSS library to allow touch, mouse or scrollwheel scrolling within specified elements, with pagination, snapping and bouncing support.",
4-
"version": "0.6.2",
4+
"version": "0.7.0",
55
"main": "lib/ftscroller.js",
66
"scripts": [
77
"lib/ftscroller.js"

lib/ftscroller.js

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*
4040
* @copyright The Financial Times Ltd [All rights reserved]
4141
* @codingstandard ftlabs-jslint
42-
* @version 0.6.2
42+
* @version 0.7.0
4343
*/
4444
/**
4545
* @license FTScroller is (c) 2012 The Financial Times Ltd [All rights reserved] and licensed under the MIT license.
@@ -733,15 +733,6 @@ var FTScroller, CubicBezier;
733733
y: inputY - _gestureStart.y
734734
};
735735

736-
// if only one axis scroll is used, bubble up the other scroll wheel event
737-
// e.g. if only x axis scroll is used then scrolling y axis can bubble up to scroll the page
738-
if(!_instanceOptions.invertScrollWheel && (
739-
(_instanceOptions.scrollingX && !_instanceOptions.scrollingY && Math.abs(gesture.x) < Math.abs(gesture.y)) ||
740-
(!_instanceOptions.scrollingX && _instanceOptions.scrollingY && Math.abs(gesture.x) > Math.abs(gesture.y))
741-
)) {
742-
return;
743-
}
744-
745736
// Opera fix
746737
if (inputTime <= 0) {
747738
inputTime = Date.now();
@@ -785,18 +776,18 @@ var FTScroller, CubicBezier;
785776
// Determine scroll distance beyond bounds
786777
distancesBeyondBounds = _distancesBeyondBounds(_targetScrollPosition);
787778

788-
// Determine whether to prevent the default scroll event - if the scroll could still
789-
// be triggered, prevent the default to avoid problems (particularly on PlayBook)
790-
if (_instanceOptions.bouncing || scrollInterrupt || (_scrollableAxes.x && gesture.x && distancesBeyondBounds.x < 0) || (_scrollableAxes.y && gesture.y && distancesBeyondBounds.y < 0)) {
791-
rawEvent.preventDefault();
792-
}
793-
794779
// Check scrolled distance against the boundary limit to see if scrolling can be triggered.
795780
// If the scroll has been interrupted, trigger at once
796781
if (!scrollInterrupt && (!_scrollableAxes.x || Math.abs(gesture.x) < _instanceOptions.scrollResponseBoundary) && (!_scrollableAxes.y || Math.abs(gesture.y) < _instanceOptions.scrollResponseBoundary)) {
797782
return;
798783
}
799784

785+
// Determine whether to prevent the default scroll event - if the scroll could still
786+
// be triggered, prevent the default to avoid problems (particularly on PlayBook)
787+
if (_instanceOptions.bouncing || scrollInterrupt || (_scrollableAxes.x && gesture.x && distancesBeyondBounds.x < 0) || (_scrollableAxes.y && gesture.y && distancesBeyondBounds.y < 0)) {
788+
rawEvent.preventDefault();
789+
}
790+
800791
// If bouncing is disabled, and already at an edge and scrolling beyond the edge, ignore the scroll for
801792
// now - this allows other scrollers to claim if appropriate, allowing nicer nested scrolls.
802793
if (!_instanceOptions.bouncing && !scrollInterrupt && (!_scrollableAxes.x || !gesture.x || distancesBeyondBounds.x > 0) && (!_scrollableAxes.y || !gesture.y || distancesBeyondBounds.y > 0)) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ftscroller",
3-
"version": "0.6.2",
3+
"version": "0.7.0",
44
"author": "FT Labs <[email protected]> (http://labs.ft.com/)",
55
"description": "FTScroller is a cross-browser Javascript/CSS library to allow touch, mouse or scrollwheel scrolling within specified elements, with pagination, snapping and bouncing support.",
66
"contributors": [

0 commit comments

Comments
 (0)