decrease mouse handlers count and every-time class checking during mousemove
This commit is contained in:
parent
3821413589
commit
05b20f45ef
@ -250,30 +250,28 @@
|
||||
var currentLeft;
|
||||
var currentPageX;
|
||||
|
||||
var inScrolling = false;
|
||||
$scrollbarX.bind(eventClass('mousedown'), function (e) {
|
||||
currentPageX = e.pageX;
|
||||
currentLeft = $scrollbarX.position().left;
|
||||
$scrollbarXRail.addClass('in-scrolling');
|
||||
inScrolling = true;
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(ownerDocument).bind(eventClass('mousemove'), function (e) {
|
||||
if (inScrolling) {
|
||||
var mouseMoveHandler = function (e) {
|
||||
updateScrollLeft(currentLeft, e.pageX - currentPageX);
|
||||
updateGeometry();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$(ownerDocument).bind(eventClass('mouseup'), function (e) {
|
||||
if (inScrolling) {
|
||||
inScrolling = false;
|
||||
var mouseUpHandler = function (e) {
|
||||
$scrollbarXRail.removeClass('in-scrolling');
|
||||
}
|
||||
$(ownerDocument).unbind(eventClass('mousemove'), mouseMoveHandler);
|
||||
};
|
||||
|
||||
$scrollbarX.bind(eventClass('mousedown'), function (e) {
|
||||
currentPageX = e.pageX;
|
||||
currentLeft = $scrollbarX.position().left;
|
||||
$scrollbarXRail.addClass('in-scrolling');
|
||||
|
||||
$(ownerDocument).bind(eventClass('mousemove'), mouseMoveHandler);
|
||||
$(ownerDocument).one(eventClass('mouseup'), mouseUpHandler);
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
currentLeft =
|
||||
@ -284,30 +282,28 @@
|
||||
var currentTop;
|
||||
var currentPageY;
|
||||
|
||||
var inScrolling = false;
|
||||
$scrollbarY.bind(eventClass('mousedown'), function (e) {
|
||||
currentPageY = e.pageY;
|
||||
currentTop = $scrollbarY.position().top;
|
||||
inScrolling = true;
|
||||
$scrollbarYRail.addClass('in-scrolling');
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$(ownerDocument).bind(eventClass('mousemove'), function (e) {
|
||||
if (inScrolling) {
|
||||
var mouseMoveHandler = function (e) {
|
||||
updateScrollTop(currentTop, e.pageY - currentPageY);
|
||||
updateGeometry();
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$(ownerDocument).bind(eventClass('mouseup'), function (e) {
|
||||
if (inScrolling) {
|
||||
inScrolling = false;
|
||||
var mouseUpHandler = function (e) {
|
||||
$scrollbarYRail.removeClass('in-scrolling');
|
||||
}
|
||||
$(ownerDocument).unbind(eventClass('mousemove'), mouseMoveHandler);
|
||||
};
|
||||
|
||||
$scrollbarY.bind(eventClass('mousedown'), function (e) {
|
||||
currentPageY = e.pageY;
|
||||
currentTop = $scrollbarY.position().top;
|
||||
$scrollbarYRail.addClass('in-scrolling');
|
||||
|
||||
$(ownerDocument).bind(eventClass('mousemove'), mouseMoveHandler);
|
||||
$(ownerDocument).one(eventClass('mouseup'), mouseUpHandler);
|
||||
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
currentTop =
|
||||
|
Loading…
Reference in New Issue
Block a user