//>>built
define("dojox/drawing/ui/dom/Pan",["dojo","../../util/oo","../../plugins/_Plugin","../../manager/_registry"],function(a,d,r,s){a.deprecated("dojox.drawing.ui.dom.Pan","It may not even make it to the 1.4 release.",1.4);d=d.declare(r,function(b){this.domNode=b.node;var l;a.connect(this.domNode,"click",this,"onSetPan");a.connect(this.keys,"onKeyUp",this,"onKeyUp");a.connect(this.keys,"onKeyDown",this,"onKeyDown");a.connect(this.anchors,"onAnchorUp",this,"checkBounds");a.connect(this.stencils,"register",
this,"checkBounds");a.connect(this.canvas,"resize",this,"checkBounds");a.connect(this.canvas,"setZoom",this,"checkBounds");a.connect(this.canvas,"onScroll",this,function(){this._blockScroll?this._blockScroll=!1:(l&&clearTimeout(l),l=setTimeout(a.hitch(this,"checkBounds"),200))});this._mouseHandle=this.mouse.register(this)},{selected:!1,type:"dojox.drawing.ui.dom.Pan",onKeyUp:function(b){if(32==b.keyCode)this.onSetPan(!1)},onKeyDown:function(b){if(32==b.keyCode)this.onSetPan(!0)},onSetPan:function(b){if(!0===
b||!1===b)this.selected=!b;this.selected?(this.selected=!1,a.removeClass(this.domNode,"selected")):(this.selected=!0,a.addClass(this.domNode,"selected"));this.mouse.setEventMode(this.selected?"pan":"")},onPanDrag:function(b){this.canvas.domNode.parentNode.scrollTop-=b.move.y;this.canvas.domNode.parentNode.scrollLeft-=b.move.x;this.canvas.onScroll()},onStencilUp:function(){this.checkBounds()},onStencilDrag:function(){},checkBounds:function(){var b=Infinity,a=-Infinity,e=-Infinity,d=Infinity,m=0,n=
0,i=this.stencils.group?this.stencils.group.getTransform():{dx:0,dy:0},f=this.mouse.scrollOffset(),g=this.canvas.height,h=this.canvas.width,q=this.canvas.zoom,j=this.canvas.parentHeight,k=this.canvas.parentWidth;this.stencils.withSelected(function(c){c=c.getBounds();b=Math.min(c.y1+i.dy,b);a=Math.max(c.x2+i.dx,a);e=Math.max(c.y2+i.dy,e);d=Math.min(c.x1+i.dx,d)});this.stencils.withUnselected(function(c){c=c.getBounds();b=Math.min(c.y1,b);a=Math.max(c.x2,a);e=Math.max(c.y2,e);d=Math.min(c.x1,d)});var e=
e*q,o=0,p=0;e>j||f.top?(g=Math.max(e,j+f.top),n=f.top,o+=this.canvas.getScrollWidth()):!n&&g>j&&(g=j);a*=q;a>k||f.left?(h=Math.max(a,k+f.left),m=f.left,p+=this.canvas.getScrollWidth()):!m&&h>k&&(h=k);h+=2*o;g+=2*p;this._blockScroll=!0;this.stencils.group&&this.stencils.group.applyTransform({dx:0,dy:0});this.stencils.withUnselected(function(a){a.transformPoints({dx:0,dy:0})});this.canvas.setDimensions(h,g,m,n)}});a.setObject("dojox.drawing.ui.dom.Pan",d);d.setup={name:"dojox.drawing.ui.dom.Pan",tooltip:"Pan Tool",
iconClass:"iconPan"};s.register(d.setup,"plugin");return d});