Browse Source

#707: + abs for _ghostIsLast

pull/739/head
RubaXa 9 years ago
parent
commit
569b1187bd
  1. 9
      Sortable.js

9
Sortable.js

@ -659,7 +659,6 @@
if ((el.children.length === 0) || (el.children[0] === ghostEl) || if ((el.children.length === 0) || (el.children[0] === ghostEl) ||
(el === evt.target) && (target = _ghostIsLast(el, evt)) (el === evt.target) && (target = _ghostIsLast(el, evt))
) { ) {
if (target) { if (target) {
if (target.animated) { if (target.animated) {
return; return;
@ -1185,9 +1184,13 @@
/** @returns {HTMLElement|false} */ /** @returns {HTMLElement|false} */
function _ghostIsLast(el, evt) { function _ghostIsLast(el, evt) {
var lastEl = el.lastElementChild, var lastEl = el.lastElementChild,
rect = lastEl.getBoundingClientRect(); rect = lastEl.getBoundingClientRect();
return ((evt.clientY - (rect.top + rect.height) > 5) || (evt.clientX - (rect.right + rect.width) > 5)) && lastEl; // min delta // 5 — min delta
return (
(abs(evt.clientY - (rect.top + rect.height)) > 5) ||
(abs(evt.clientX - (rect.right + rect.width)) > 5)
) && lastEl;
} }

Loading…
Cancel
Save