Browse Source

Fixing Insertion Position Logic

In 'Floating' Container
- Insertion after non-adjacent sibling where insertion after is allowed
- Insertion before non-adjacent sibling where insertion before is allowed
- Fixing indentation
pull/1311/head
William 7 years ago
parent
commit
d9df31444b
  1. 8
      Sortable.js

8
Sortable.js

@ -843,15 +843,15 @@
tgTop = target.offsetTop; tgTop = target.offsetTop;
if (elTop === tgTop) { if (elTop === tgTop) {
after = (target.previousElementSibling === dragEl) && !isWide || halfway && isWide; after = (target.previousElementSibling === dragEl) && !isWide || halfway;
} }
else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) { else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
after = (evt.clientY - targetRect.top) / height > 0.5; after = (evt.clientY - targetRect.top) / height > 0.5;
} else { } else {
after = tgTop > elTop; after = halfway;
} }
} else if (!isMovingBetweenSortable) { } else if (!isMovingBetweenSortable) {
after = (nextSibling !== dragEl) && !isLong || halfway && isLong; after = (nextSibling !== dragEl) && !isLong || halfway;
} }
var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);

Loading…
Cancel
Save