|
@@ -82,14 +82,18 @@
|
|
.off('mousemove.' + scrollbarID)
|
|
.off('mousemove.' + scrollbarID)
|
|
.on('mousemove.' + scrollbarID, function (_e) {
|
|
.on('mousemove.' + scrollbarID, function (_e) {
|
|
if (!scrolling) return;
|
|
if (!scrolling) return;
|
|
- let delta = _e.screenX - origX;
|
|
|
|
- if((origLeft + delta) >= 0 && (origLeft + delta + tracker.width()) <= stagScrollbarUI.width()) {
|
|
|
|
- tracker.css({
|
|
|
|
- marginLeft: (origLeft + delta) + 'px'
|
|
|
|
- });
|
|
|
|
- let percentScrolled = delta/(stagScrollbarUI.width() - tracker.width());
|
|
|
|
- $(self).scrollLeft((self.scrollWidth - $(self).width()) * percentScrolled);
|
|
|
|
|
|
+ let delta = _e.screenX - origX, finalML = origLeft + delta;
|
|
|
|
+ if(finalML < 0) {
|
|
|
|
+ finalML = 0;
|
|
}
|
|
}
|
|
|
|
+ else if(finalML + tracker.width() > stagScrollbarUI.width()) {
|
|
|
|
+ finalML = stagScrollbarUI.width() - tracker.width();
|
|
|
|
+ }
|
|
|
|
+ tracker.css({
|
|
|
|
+ marginLeft: finalML + 'px'
|
|
|
|
+ });
|
|
|
|
+ let percentScrolled = delta/(stagScrollbarUI.width() - tracker.width());
|
|
|
|
+ $(self).scrollLeft((self.scrollWidth - $(self).width()) * percentScrolled);
|
|
})
|
|
})
|
|
.off('mouseup.' + scrollbarID)
|
|
.off('mouseup.' + scrollbarID)
|
|
.on('mouseup.' + scrollbarID, function (_e) {
|
|
.on('mouseup.' + scrollbarID, function (_e) {
|