Browse Source

#271: * logic of auto-scrolling

scroll
RubaXa 10 years ago
parent
commit
ab52c13850
  1. 20
      Sortable.js

20
Sortable.js

@ -424,20 +424,28 @@
winWidth = window.innerWidth,
winHeight = window.innerHeight,
vx = (winWidth - x <= sens) - (x <= sens),
vy = (winHeight - y <= sens) - (y <= sens)
vx,
vy
;
if (vx || vy) {
el = win;
}
else if (scrollEl) {
if (scrollEl) {
el = scrollEl;
rect = scrollEl.getBoundingClientRect();
vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
}
if (!(vx || vy)) {
vx = (winWidth - x <= sens) - (x <= sens);
vy = (winHeight - y <= sens) - (y <= sens);
/* jshint expr:true */
(vx || vy) && (el = win);
}
if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
autoScroll.el = el;
autoScroll.vx = vx;

Loading…
Cancel
Save