Allow the clicking of a rail to propagate

This commit is contained in:
Dan Maglasang 2015-07-22 22:43:38 -04:00
parent 6c642d8a47
commit 158b113d18
2 changed files with 8 additions and 3 deletions

View File

@ -14,5 +14,6 @@ module.exports = {
suppressScrollX: false, suppressScrollX: false,
suppressScrollY: false, suppressScrollY: false,
scrollXMarginOffset: 0, scrollXMarginOffset: 0,
scrollYMarginOffset: 0 scrollYMarginOffset: 0,
stopPropagationOnClick: true
}; };

View File

@ -13,7 +13,9 @@ function bindClickRailHandler(element, i) {
} }
var stopPropagation = window.Event.prototype.stopPropagation.bind; var stopPropagation = window.Event.prototype.stopPropagation.bind;
if (i.settings.stopPropagationOnClick) {
i.event.bind(i.scrollbarY, 'click', stopPropagation); i.event.bind(i.scrollbarY, 'click', stopPropagation);
}
i.event.bind(i.scrollbarYRail, 'click', function (e) { i.event.bind(i.scrollbarYRail, 'click', function (e) {
var halfOfScrollbarLength = h.toInt(i.scrollbarYHeight / 2); var halfOfScrollbarLength = h.toInt(i.scrollbarYHeight / 2);
var positionTop = i.railYRatio * (e.pageY - window.scrollY - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength); var positionTop = i.railYRatio * (e.pageY - window.scrollY - pageOffset(i.scrollbarYRail).top - halfOfScrollbarLength);
@ -32,7 +34,9 @@ function bindClickRailHandler(element, i) {
e.stopPropagation(); e.stopPropagation();
}); });
if (i.settings.stopPropagationOnClick) {
i.event.bind(i.scrollbarX, 'click', stopPropagation); i.event.bind(i.scrollbarX, 'click', stopPropagation);
}
i.event.bind(i.scrollbarXRail, 'click', function (e) { i.event.bind(i.scrollbarXRail, 'click', function (e) {
var halfOfScrollbarLength = h.toInt(i.scrollbarXWidth / 2); var halfOfScrollbarLength = h.toInt(i.scrollbarXWidth / 2);
var positionLeft = i.railXRatio * (e.pageX - window.scrollX - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength); var positionLeft = i.railXRatio * (e.pageX - window.scrollX - pageOffset(i.scrollbarXRail).left - halfOfScrollbarLength);