Fix broken drag scrolling when left is out of viewport

Related to #390
This commit is contained in:
DanielApt 2015-11-09 23:11:33 +00:00
parent e9024292cd
commit 3b134d6193

View File

@ -15,7 +15,11 @@ function bindMouseScrollXHandler(element, i) {
function updateScrollLeft(deltaX) {
var newLeft = currentLeft + (deltaX * i.railXRatio);
var maxLeft = i.scrollbarXRail.getBoundingClientRect().left + (i.railXRatio * (i.railXWidth - i.scrollbarXWidth));
var scrollbarXLeft = i.scrollbarXRail.getBoundingClientRect().left;
if (scrollbarXLeft < 0) {
scrollbarXLeft = 0;
}
var maxLeft = scrollbarXLeft + (i.railXRatio * (i.railXWidth - i.scrollbarXWidth));
if (newLeft < 0) {
i.scrollbarXLeft = 0;