|
|
@ -39,6 +39,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
scrollEl, |
|
|
|
scrollEl, |
|
|
|
scrollParentEl, |
|
|
|
scrollParentEl, |
|
|
|
|
|
|
|
scrollCustomFn, |
|
|
|
|
|
|
|
|
|
|
|
lastEl, |
|
|
|
lastEl, |
|
|
|
lastCSS, |
|
|
|
lastCSS, |
|
|
@ -99,13 +100,17 @@ |
|
|
|
winHeight = window.innerHeight, |
|
|
|
winHeight = window.innerHeight, |
|
|
|
|
|
|
|
|
|
|
|
vx, |
|
|
|
vx, |
|
|
|
vy |
|
|
|
vy, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scrollOffsetX, |
|
|
|
|
|
|
|
scrollOffsetY |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
|
// Delect scrollEl
|
|
|
|
// Delect scrollEl
|
|
|
|
if (scrollParentEl !== rootEl) { |
|
|
|
if (scrollParentEl !== rootEl) { |
|
|
|
scrollEl = options.scroll; |
|
|
|
scrollEl = options.scroll; |
|
|
|
scrollParentEl = rootEl; |
|
|
|
scrollParentEl = rootEl; |
|
|
|
|
|
|
|
scrollCustomFn = options.scrollFn; |
|
|
|
|
|
|
|
|
|
|
|
if (scrollEl === true) { |
|
|
|
if (scrollEl === true) { |
|
|
|
scrollEl = rootEl; |
|
|
|
scrollEl = rootEl; |
|
|
@ -147,11 +152,18 @@ |
|
|
|
|
|
|
|
|
|
|
|
if (el) { |
|
|
|
if (el) { |
|
|
|
autoScroll.pid = setInterval(function () { |
|
|
|
autoScroll.pid = setInterval(function () { |
|
|
|
|
|
|
|
scrollOffsetY = vy ? vy * speed : 0; |
|
|
|
|
|
|
|
scrollOffsetX = vx ? vx * speed : 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ('function' === typeof(scrollCustomFn)) { |
|
|
|
|
|
|
|
return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (el === win) { |
|
|
|
if (el === win) { |
|
|
|
win.scrollTo(win.pageXOffset + vx * speed, win.pageYOffset + vy * speed); |
|
|
|
win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
vy && (el.scrollTop += vy * speed); |
|
|
|
el.scrollTop += scrollOffsetY; |
|
|
|
vx && (el.scrollLeft += vx * speed); |
|
|
|
el.scrollLeft += scrollOffsetX; |
|
|
|
} |
|
|
|
} |
|
|
|
}, 24); |
|
|
|
}, 24); |
|
|
|
} |
|
|
|
} |
|
|
@ -681,7 +693,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
_cloneHide(isOwner); |
|
|
|
_cloneHide(isOwner); |
|
|
|
|
|
|
|
|
|
|
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect) !== false) { |
|
|
|
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) { |
|
|
|
if (!dragEl.contains(el)) { |
|
|
|
if (!dragEl.contains(el)) { |
|
|
|
el.appendChild(dragEl); |
|
|
|
el.appendChild(dragEl); |
|
|
|
parentEl = el; // actualization
|
|
|
|
parentEl = el; // actualization
|
|
|
@ -708,7 +720,7 @@ |
|
|
|
isLong = (target.offsetHeight > dragEl.offsetHeight), |
|
|
|
isLong = (target.offsetHeight > dragEl.offsetHeight), |
|
|
|
halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5, |
|
|
|
halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5, |
|
|
|
nextSibling = target.nextElementSibling, |
|
|
|
nextSibling = target.nextElementSibling, |
|
|
|
moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect), |
|
|
|
moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt), |
|
|
|
after |
|
|
|
after |
|
|
|
; |
|
|
|
; |
|
|
|
|
|
|
|
|
|
|
@ -1158,7 +1170,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect) { |
|
|
|
function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt) { |
|
|
|
var evt, |
|
|
|
var evt, |
|
|
|
sortable = fromEl[expando], |
|
|
|
sortable = fromEl[expando], |
|
|
|
onMoveFn = sortable.options.onMove, |
|
|
|
onMoveFn = sortable.options.onMove, |
|
|
@ -1177,7 +1189,7 @@ |
|
|
|
fromEl.dispatchEvent(evt); |
|
|
|
fromEl.dispatchEvent(evt); |
|
|
|
|
|
|
|
|
|
|
|
if (onMoveFn) { |
|
|
|
if (onMoveFn) { |
|
|
|
retVal = onMoveFn.call(sortable, evt); |
|
|
|
retVal = onMoveFn.call(sortable, evt, originalEvt); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return retVal; |
|
|
|
return retVal; |
|
|
|