dd-ddm-base-min.js revision 489504a37b99aa0273fca2d41ae36da3356233cf
YUI.add("dd-ddm-base",function(b){var a=function(){a.superclass.constructor.apply(this,arguments);};a.NAME="ddm";a.ATTRS={dragCursor:{value:"move"},clickPixelThresh:{value:3},clickTimeThresh:{value:1000},throttleTime:{value:-1},dragMode:{value:"point",setter:function(c){this._setDragMode(c);return c;}}};b.extend(a,b.Base,{_createPG:function(){},_active:null,_setDragMode:function(c){if(c===null){c=b.DD.DDM.get("dragMode");}switch(c){case 1:case"intersect":return 1;case 2:case"strict":return 2;case 0:case"point":return 0;}return 0;},CSS_PREFIX:b.ClassNameManager.getClassName("dd"),_activateTargets:function(){},_drags:[],activeDrag:false,_regDrag:function(c){if(this.getDrag(c.get("node"))){return false;}if(!this._active){this._setupListeners();}this._drags.push(c);return true;},_unregDrag:function(e){var c=[];b.each(this._drags,function(f,d){if(f!==e){c[c.length]=f;}});this._drags=c;},_setupListeners:function(){this._createPG();this._active=true;var c=b.one(b.config.doc);c.on("mousemove",b.throttle(b.bind(this._move,this),this.get("throttleTime")));c.on("mouseup",b.bind(this._end,this));},_start:function(){this.fire("ddm:start");this._startDrag();},_startDrag:function(){},_endDrag:function(){},_dropMove:function(){},_end:function(){if(this.activeDrag){this._endDrag();this.fire("ddm:end");this.activeDrag.end.call(this.activeDrag);this.activeDrag=null;}},stopDrag:function(){if(this.activeDrag){this._end();}return this;},_move:function(c){if(this.activeDrag){this.activeDrag._move.call(this.activeDrag,c);this._dropMove();}},cssSizestoObject:function(d){var c=d.split(" ");switch(c.length){case 1:c[1]=c[2]=c[3]=c[0];break;case 2:c[2]=c[0];c[3]=c[1];break;case 3:c[3]=c[1];break;}return{top:parseInt(c[0],10),right:parseInt(c[1],10),bottom:parseInt(c[2],10),left:parseInt(c[3],10)};},getDrag:function(d){var c=false,e=b.one(d);if(e instanceof b.Node){b.each(this._drags,function(g,f){if(e.compareTo(g.get("node"))){c=g;}});}return c;},swapPosition:function(d,c){d=b.DD.DDM.getNode(d);c=b.DD.DDM.getNode(c);var f=d.getXY(),e=c.getXY();d.setXY(e);c.setXY(f);return d;},getNode:function(c){if(c&&c.get){if(b.Widget&&(c instanceof b.Widget)){c=c.get("boundingBox");}else{c=c.get("node");}}else{c=b.one(c);}return c;},swapNode:function(e,c){e=b.DD.DDM.getNode(e);c=b.DD.DDM.getNode(c);var f=c.get("parentNode"),d=c.get("nextSibling");if(d==e){f.insertBefore(e,c);}else{if(c==e.get("nextSibling")){f.insertBefore(c,e);}else{e.get("parentNode").replaceChild(c,e);f.insertBefore(e,d);}}return e;}});b.namespace("DD");b.DD.DDM=new a();},"@VERSION@",{skinnable:false,requires:["node","base","yui-throttle","classnamemanager"]});