Browse Source

Merge branch 'revertClone'

pull/1043/head
Lebedev Konstantin 8 years ago
parent
commit
da6ee2fa57
  1. 27
      Sortable.js

27
Sortable.js

@ -210,6 +210,7 @@
group.name = originalGroup.name;
group.checkPull = toFn(originalGroup.pull, true);
group.checkPut = toFn(originalGroup.put);
group.revertClone = originalGroup.revertClone;
options.group = group;
}
@ -709,7 +710,7 @@
putSortable = this;
if (revert) {
_cloneHide(true);
_cloneHide(activeSortable, true);
parentEl = rootEl; // actualization
if (cloneEl || nextEl) {
@ -734,7 +735,7 @@
targetRect = target.getBoundingClientRect();
}
_cloneHide(isOwner);
_cloneHide(activeSortable, isOwner);
if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
if (!dragEl.contains(el)) {
@ -771,7 +772,7 @@
_silent = true;
setTimeout(_unsilent, 30);
_cloneHide(isOwner);
_cloneHide(activeSortable, isOwner);
if (moveVector === 1 || moveVector === -1) {
after = (moveVector === 1);
@ -815,6 +816,10 @@
if (ms) {
var currentRect = target.getBoundingClientRect();
if (prevRect.nodeType === 1) {
prevRect = prevRect.getBoundingClientRect();
}
_css(target, 'transition', 'none');
_css(target, 'transform', 'translate3d('
+ (prevRect.left - currentRect.left) + 'px,'
@ -1094,10 +1099,21 @@
};
function _cloneHide(state) {
function _cloneHide(sortable, state) {
if (cloneEl && (cloneEl.state !== state)) {
_css(cloneEl, 'display', state ? 'none' : '');
!state && cloneEl.state && rootEl.insertBefore(cloneEl, dragEl);
if (!state) {
if (cloneEl.state) {
if (sortable.options.group.revertClone) {
rootEl.insertBefore(cloneEl, nextEl);
sortable._animate(dragEl, cloneEl);
} else {
rootEl.insertBefore(cloneEl, dragEl);
}
}
}
cloneEl.state = state;
}
}
@ -1374,7 +1390,6 @@
);
}
// Export utils
Sortable.utils = {
on: _on,

Loading…
Cancel
Save