Change dragging logic.

Using `updateBarSizeAndPosition` instead of manual update of scrollbar
CSS styles.
This commit is contained in:
Hyunje Alex Jun 2014-08-07 13:25:46 +01:00
parent 2b87bbe081
commit a022621df8

View File

@ -123,12 +123,6 @@
var scrollTop = parseInt(scrollbarYTop * (contentHeight - containerHeight) / (containerHeight - scrollbarYHeight), 10);
$this.scrollTop(scrollTop);
if (isScrollbarXUsingBottom) {
$scrollbarXRail.css({bottom: scrollbarXBottom - scrollTop});
} else {
$scrollbarXRail.css({top: scrollbarXTop + scrollTop});
}
};
var updateContentScrollLeft = function (currentLeft, deltaX) {
@ -147,12 +141,6 @@
var scrollLeft = parseInt(scrollbarXLeft * (contentWidth - containerWidth) / (containerWidth - scrollbarXWidth), 10);
$this.scrollLeft(scrollLeft);
if (isScrollbarYUsingRight) {
$scrollbarYRail.css({right: scrollbarYRight - scrollLeft});
} else {
$scrollbarYRail.css({left: scrollbarYLeft + scrollLeft});
}
};
var getSettingsAdjustedThumbSize = function (thumbSize) {
@ -267,6 +255,7 @@
$(document).bind('mousemove' + eventClassName, function (e) {
if ($scrollbarXRail.hasClass('in-scrolling')) {
updateContentScrollLeft(currentLeft, e.pageX - currentPageX);
updateBarSizeAndPosition();
e.stopPropagation();
e.preventDefault();
}
@ -297,6 +286,7 @@
$(document).bind('mousemove' + eventClassName, function (e) {
if ($scrollbarYRail.hasClass('in-scrolling')) {
updateContentScrollTop(currentTop, e.pageY - currentPageY);
updateBarSizeAndPosition();
e.stopPropagation();
e.preventDefault();
}