From a89b3b3edc6422f1b3540a4811434d4900d91719 Mon Sep 17 00:00:00 2001 From: RubaXa Date: Wed, 15 Apr 2015 14:27:28 +0300 Subject: [PATCH] #347: + moveVector --- Sortable.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Sortable.js b/Sortable.js index 346887e..7888d05 100644 --- a/Sortable.js +++ b/Sortable.js @@ -561,7 +561,7 @@ _cloneHide(isOwner); - if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect)) { + if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect) !== false) { el.appendChild(dragEl); this._animate(dragRect, dragEl); target && this._animate(targetRect, target); @@ -582,16 +582,20 @@ isLong = (target.offsetHeight > dragEl.offsetHeight), halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5, nextSibling = target.nextElementSibling, + moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect), after ; - if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect)) { + if (moveVector !== false) { _silent = true; setTimeout(_unsilent, 30); _cloneHide(isOwner); - if (floating) { + if (moveVector === 1 || moveVector === -1) { + after = (moveVector === 1); + } + else if (floating) { after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide; } else { after = (nextSibling !== dragEl) && !isLong || halfway && isLong; @@ -1013,7 +1017,7 @@ retVal = onMoveFn.call(sortable, evt); } - return retVal !== false; + return retVal; }