Fix broken drag scrolling when top is out of viewport

Addresses issue no. 390 #390
This commit is contained in:
DanielApt 2015-11-08 22:03:35 +00:00
parent fd53ae0b48
commit e9024292cd

View File

@ -60,7 +60,12 @@ function bindMouseScrollYHandler(element, i) {
function updateScrollTop(deltaY) {
var newTop = currentTop + (deltaY * i.railYRatio);
var maxTop = i.scrollbarYRail.getBoundingClientRect().top + (i.railYRatio * (i.railYHeight - i.scrollbarYHeight));
var scrollbarYTop = i.scrollbarYRail.getBoundingClientRect().top;
if(scrollbarYTop < 0) {
scrollbarYTop = 0;
}
var maxTop = scrollbarYTop + (i.railYRatio * (i.railYHeight - i.scrollbarYHeight));
if (newTop < 0) {
i.scrollbarYTop = 0;