Browse Source

* fixed touch & 'empty list'

pull/10/head
RubaXa 11 years ago
parent
commit
3aac111143
  1. 20
      Sortable.js
  2. 4
      Sortable.min.js
  3. 2
      package.json

20
Sortable.js

@ -123,7 +123,7 @@
target = _closest(target, options.draggable, el);
if( target && !dragEl && (target !== el) ){
if( target && !dragEl && (target.parentNode === el) ){
tapEvt = evt;
target.draggable = true;
@ -175,7 +175,6 @@
do {
if( parent[expando] === group ){
while( i-- ){
touchDragOverListeners[i]({
clientX: touchEvt.clientX,
@ -186,6 +185,8 @@
}
break;
}
target = parent; // store last element
}
while( parent = parent.parentNode );
@ -247,7 +248,7 @@
_on(document, 'touchmove', this._onTouchMove);
_on(document, 'touchend', this._onDrop);
this._loopId = setInterval(this._emulateDragOver, 200);
this._loopId = setInterval(this._emulateDragOver, 150);
}
else {
dataTransfer.effectAllowed = 'move';
@ -261,17 +262,16 @@
_onDragOver: function (evt){
if( !_silent && activeGroup === this.options.group && (evt.rootEl === void 0 || evt.rootEl === this.el) ){
if( !_silent && (activeGroup === this.options.group) && (evt.rootEl === void 0 || evt.rootEl === this.el) ){
var
el = this.el
, target = _closest(evt.target, this.options.draggable, el)
;
if( !target || target[expando] === void 0 ){
if( el.children.length === 0 ){
if( el.children.length === 0 || el.children[0] === ghostEl ){
el.appendChild(dragEl);
}
else if( target && target !== dragEl ){
else if( target && target !== dragEl && (target.parentNode[expando] !== void 0) ){
if( lastEl !== target ){
lastEl = target;
lastCSS = _css(target)
@ -284,8 +284,8 @@
, height = rect.bottom - rect.top
, floating = /left|right|inline/.test(lastCSS.cssFloat + lastCSS.display)
, skew = (floating ? (evt.clientX - rect.left)/width : (evt.clientY - rect.top)/height) > .5
, isLong = (target.offsetHeight > dragEl.offsetHeight)
, isWide = (target.offsetWidth > dragEl.offsetWidth)
, isLong = (target.offsetHeight > dragEl.offsetHeight)
, nextSibling = target.nextSibling
, after
;
@ -306,7 +306,6 @@
}
}
}
}
},
@ -347,7 +346,6 @@
}
}
// Set NULL
rootEl =
dragEl =
@ -503,7 +501,7 @@
};
Sortable.version = '0.1.4';
Sortable.version = '0.1.5';
// Export
return Sortable;

4
Sortable.min.js vendored

File diff suppressed because one or more lines are too long

2
package.json

@ -1,7 +1,7 @@
{
"name": "sortable",
"exportName": "Sortable",
"version": "0.1.4",
"version": "0.1.5",
"devDependencies": {
"grunt": "*",
"grunt-version": "*",

Loading…
Cancel
Save