javascript

jquery sortable 위치 버그 수정(jquery sortable position bug modify) 수정.

새로운 도전을 위한 한걸음 2013. 3. 7. 14:02

jquery.ui.sortable.zip


 jquery sortable 위치 버그 수정(jquery sortable position bug modify) 수정. 

버전이 변경된경우 아래 부분만 변경하면 자동으로 적용됨.

_intersectsWithPointer: function(item) {


//ytkim modify start

if(this.dragAreaItem == item.item[0]){

//console.log('111111111111111', item.item[0].innerText)

return false;

}

var tmpPositionAbs =this.positionAbs

,ratio=3

,thisT = tmpPositionAbs.top

,thisH=this.currentItem[0].clientHeight

,thisL = tmpPositionAbs.left

,thisW=this.currentItem[0].clientWidth

,itemT = item.top

,itemH=item.height

,itemL = item.left

,itemW= item.width

,verticalDirection = this._getDragVerticalDirection() 

,horizontalDirection = this._getDragHorizontalDirection()

,isOverElementHeight = this._getIntersectsWithPointerAndSides(thisT,thisH, itemT, itemH, ratio)

,isOverElementWidth = this._getIntersectsWithPointerAndSides(thisL,thisW, itemL, itemW, ratio);

if(!(isOverElementHeight && isOverElementWidth)) return false;


this.dragAreaItem =  item.item[0]; 

tmpH = horizontalDirection;

//가로 영역 위치값 잡기. 

if( $(item.item[0]).prev()[0] ==this.placeholder[0]  && this.floating){

horizontalDirection = 'right';

verticalDirection = 'down';

}else if($($(item.item[0]).next()).next()[0] ==this.placeholder[0] && this.floating){

horizontalDirection = 'left';

verticalDirection = 'up';

}else if(!(!verticalDirection  && horizontalDirection=='right')){

horizontalDirection=thisL > itemL ? ( thisL <= (itemL+itemW/ratio)?'left':'right') : ( (thisL+thisW)>(itemL+(itemW-itemW/ratio))?'left':'right');

}


if(!this.floatingCheckFlag){

if(!this.floating ){

var o = this.options;

this.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;

this.floatingCheckFlag = true;

}

}

//ytkim modify end

return this.floating ?

( ((horizontalDirection && horizontalDirection == "right") || verticalDirection == "down") ? 2 : 1 )

: ( verticalDirection && (verticalDirection == "down" ? 2 : 1) );

},

//ytkim modify start

// 드래그 영역 넘었는지 여부 체크.

_getIntersectsWithPointerAndSides: function (aPosi, aSize, bPosi, bSize, ratio){

return (aPosi > bPosi ? (aPosi - (bPosi+bSize/ratio)) : ((bPosi+(bSize- bSize/ratio)) - (aPosi+aSize))) <=0 ? true:false;

},

//ytkim modify end


_intersectsWithSides: function(item) {

//ytkim modify start

return true;

//ytkim modify end

},