1
2
3
4
5
| //>>built
| define(["dojo","dojox","dojo/dnd/Selector"],function(g,t){return g.declare("dojox.dnd.Selector",g.dnd.Selector,{conservative:!0,isSelected:function(a){a=g.isString(a)?a:a.id;return this.getItem(a)&&this.selected[a]},selectNode:function(a,b){b||this.selectNone();b=g.isString(a)?a:a.id;this.getItem(b)&&(this._removeAnchor(),this.anchor=g.byId(a),this._addItemClass(this.anchor,"Anchor"),this.selection[b]=1,this._addItemClass(this.anchor,"Selected"));return this},deselectNode:function(a){var b=g.isString(a)?
| a:a.id;this.getItem(b)&&this.selection[b]&&(this.anchor===g.byId(a)&&this._removeAnchor(),delete this.selection[b],this._removeItemClass(this.anchor,"Selected"));return this},selectByBBox:function(a,b,e,f,c){c||this.selectNone();this.forInItems(function(d,c){(d=g.byId(c))&&this._isBoundedByBox(d,a,b,e,f)&&this.selectNode(c,!0)},this);return this},_isBoundedByBox:function(a,b,e,f,c){return this.conservative?this._conservativeBBLogic(a,b,e,f,c):this._liberalBBLogic(a,b,e,f,c)},shift:function(a,b){var e=
| this.getSelectedNodes();e&&e.length&&this.selectNode(this._getNodeId(e[e.length-1].id,a),b)},_getNodeId:function(a,b){for(var e=this.getAllNodes(),f=a,c=0,d=e.length;c<d;++c)if(e[c].id==a){a=Math.min(d-1,Math.max(0,c+(b?1:-1)));c!=a&&(f=e[a].id);break}return f},_conservativeBBLogic:function(a,b,e,f,c){a=g.coords(a);var d;b>f&&(d=b,b=f,f=d);e>c&&(d=e,e=c,c=d);return a.x>=b&&a.x+a.w<=f&&a.y>=e&&a.y+a.h<=c},_liberalBBLogic:function(a,b,e,f,c){var d=g.position(a),l,h,k,p=a=!1,m=d.x,q=d.y,n=d.x+d.w,r=
| d.y+d.h;b<f?(d=b,l=e):(a=!0,d=f,l=c);e<c?(p=!0,h=f,k=c):(h=b,k=e,d=f,l=c);a&&p&&(h=b,k=c,d=f,l=e);return((m>=d||n<=h)&&d<=n&&h>=m||m<=d&&n>=h)&&(l<=r&&k>=q||r>=k&&q<=k)}})});
|
|