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