Browse Source

* 'group'

pull/10/head
RubaXa 11 years ago
parent
commit
7bee9709d2
  1. 65
      Sortable.js
  2. 2
      Sortable.min.js

65
Sortable.js

@ -262,42 +262,43 @@
, target = _closest(evt.target, this.options.draggable, el) , target = _closest(evt.target, this.options.draggable, el)
; ;
if( target[expando] === void 0 ){
if( el.children.length === 0 ){ if( el.children.length === 0 ){
el.appendChild(dragEl); el.appendChild(dragEl);
}
else if( target && (target !== dragEl) ){
if( lastEl !== target ){
lastEl = target;
lastCSS = _css(target)
} }
else if( target && (target !== dragEl) ){
if( lastEl !== target ){
lastEl = target;
lastCSS = _css(target)
}
var var
rect = target.getBoundingClientRect() rect = target.getBoundingClientRect()
, width = rect.right - rect.left , width = rect.right - rect.left
, height = rect.bottom - rect.top , height = rect.bottom - rect.top
, floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display) , floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display)
, skew = (floating ? (evt.clientX - rect.left)/width : (evt.clientY - rect.top)/height) > .5 , skew = (floating ? (evt.clientX - rect.left)/width : (evt.clientY - rect.top)/height) > .5
, isLong = (target.offsetHeight > dragEl.offsetHeight) , isLong = (target.offsetHeight > dragEl.offsetHeight)
, isWide = (target.offsetWidth > dragEl.offsetWidth) , isWide = (target.offsetWidth > dragEl.offsetWidth)
, nextSibling = target.nextSibling , nextSibling = target.nextSibling
, after , after
; ;
_silent = true; _silent = true;
setTimeout(_unsilent, 30); setTimeout(_unsilent, 30);
if( floating ){ if( floating ){
after = (target.previousElementSibling === dragEl) && !isWide || (skew > .5) && isWide after = (target.previousElementSibling === dragEl) && !isWide || (skew > .5) && isWide
} else { } else {
after = (target.nextElementSibling !== dragEl) && !isLong || (skew > .5) && isLong; after = (target.nextElementSibling !== dragEl) && !isLong || (skew > .5) && isLong;
} }
if( after && !nextSibling ){ if( after && !nextSibling ){
el.appendChild(dragEl); el.appendChild(dragEl);
} else { } else {
target.parentNode.insertBefore(dragEl, after ? nextSibling : target); target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
}
} }
} }
} }

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save